Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Ping CRM to latest version of Inertia.js #99

Merged
merged 23 commits into from
Feb 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b2b7d7
Update $page object to use $page.props
reinink Dec 22, 2020
27272fb
Update app.js to use new Inertia exports
reinink Dec 22, 2020
b061668
Update login form to use the new Inertia form
reinink Dec 22, 2020
d41b483
Update logout link to a button
reinink Dec 22, 2020
9d64030
Remove old code from layout
reinink Dec 22, 2020
a1eaaf7
Update main menu to use url on Inertia page object
reinink Dec 22, 2020
f8d9865
Update create contact form to use the new Inertia form
reinink Dec 22, 2020
312a5eb
Update edit contact form to use the new Inertia form
reinink Dec 22, 2020
8b76723
Update create organization form to use the new Inertia form
reinink Dec 22, 2020
19d8005
Update edit organization form to use the new Inertia form
reinink Dec 22, 2020
f1b1fec
Update create user form to use the new Inertia form
reinink Dec 22, 2020
3c9d00d
Update edit user form to use the new Inertia form
reinink Dec 22, 2020
9a01ae5
Fix edit user form resetting
reinink Dec 22, 2020
5ea932a
Fix issue with "remember" boolean on login page
reinink Feb 27, 2021
a0c6028
Standardize form submit handlers
reinink Feb 27, 2021
3cf207b
Fix owner attribute
reinink Feb 27, 2021
13ce803
Update PHP dependencies
reinink Feb 27, 2021
6ea4d09
Simplify pagination
reinink Feb 27, 2021
12d3c1b
Add support for PHP 8
reinink Feb 27, 2021
f3b8bba
Update NPM dependencies
reinink Feb 27, 2021
5dab72d
Clean up code formatting
reinink Feb 27, 2021
adc0db7
Upgrade to Tailwind 2.0 and Laravel Mix 6
reinink Feb 27, 2021
e1f57c3
Tweak pagination line height
reinink Feb 27, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:vue/recommended',
],
extends: ['eslint:recommended', 'plugin:vue/recommended'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
},
env: {
amd: true,
browser: true,
es6: true,
},
rules: {
"indent": ['error', 2],
'quotes': ['warn', 'single'],
'semi': ['warn', 'never'],
indent: ['error', 2],
quotes: ['warn', 'single'],
semi: ['warn', 'never'],
'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
'comma-dangle': ['warn', 'always-multiline'],
'vue/max-attributes-per-line': false,
'vue/require-default-prop': false,
'vue/singleline-html-element-content-newline': false,
}
'vue/max-attributes-per-line': 'off',
'vue/require-default-prop': 'off',
'vue/singleline-html-element-content-newline': 'off',
'vue/html-self-closing': [
'warn',
{
html: {
void: 'always',
normal: 'always',
component: 'always',
},
},
],
},
}
8 changes: 8 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 10000,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"htmlWhitespaceSensitivity": "css"
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/ContactsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index()
->orderByName()
->filter(Request::only('search', 'trashed'))
->paginate()
->transform(function ($contact) {
->through(function ($contact) {
return [
'id' => $contact->id,
'name' => $contact->name,
Expand Down
10 changes: 9 additions & 1 deletion app/Http/Controllers/OrganizationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ public function index()
->orderBy('name')
->filter(Request::only('search', 'trashed'))
->paginate()
->only('id', 'name', 'phone', 'city', 'deleted_at'),
->through(function ($organization) {
return [
'id' => $organization->id,
'name' => $organization->name,
'phone' => $organization->phone,
'city' => $organization->city,
'deleted_at' => $organization->deleted_at,
];
}),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function share(Request $request)
'first_name' => $request->user()->first_name,
'last_name' => $request->user()->last_name,
'email' => $request->user()->email,
'role' => $request->user()->role,
'owner' => $request->user()->owner,
'account' => [
'id' => $request->user()->account->id,
'name' => $request->user()->account->name,
Expand Down
86 changes: 7 additions & 79 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace App\Providers;

use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\UrlWindow;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\ServiceProvider;
use League\Glide\Server;
Expand All @@ -18,12 +14,6 @@ class AppServiceProvider extends ServiceProvider
* @return void
*/
public function register()
{
$this->registerGlide();
$this->registerLengthAwarePaginator();
}

protected function registerGlide()
{
$this->app->bind(Server::class, function ($app) {
return Server::create([
Expand All @@ -35,75 +25,13 @@ protected function registerGlide()
});
}

protected function registerLengthAwarePaginator()
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->app->bind(LengthAwarePaginator::class, function ($app, $values) {
return new class(...array_values($values)) extends LengthAwarePaginator {
public function only(...$attributes)
{
return $this->transform(function ($item) use ($attributes) {
return $item->only($attributes);
});
}

public function transform($callback)
{
$this->items->transform($callback);

return $this;
}

public function toArray()
{
return [
'data' => $this->items->toArray(),
'links' => $this->links(),
];
}

public function links($view = null, $data = [])
{
$this->appends(Request::all());

$window = UrlWindow::make($this);

$elements = array_filter([
$window['first'],
is_array($window['slider']) ? '...' : null,
$window['slider'],
is_array($window['last']) ? '...' : null,
$window['last'],
]);

return Collection::make($elements)->flatMap(function ($item) {
if (is_array($item)) {
return Collection::make($item)->map(function ($url, $page) {
return [
'url' => $url,
'label' => $page,
'active' => $this->currentPage() === $page,
];
});
} else {
return [
[
'url' => null,
'label' => '...',
'active' => false,
],
];
}
})->prepend([
'url' => $this->previousPageUrl(),
'label' => 'Previous',
'active' => false,
])->push([
'url' => $this->nextPageUrl(),
'label' => 'Next',
'active' => false,
]);
}
};
});
//
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"license": "MIT",
"require": {
"php": "^7.3.0",
"php": "^7.3|^8.0",
"ext-exif": "*",
"ext-gd": "*",
"facade/ignition": "^2.3.6",
Expand Down
Loading