From 123963c14ce45d0394314fa4b68b7cfd380dbe59 Mon Sep 17 00:00:00 2001 From: Mike Roquemore Date: Sat, 2 Jul 2022 13:27:16 -0500 Subject: [PATCH 1/6] Modify genericActionsFormatter restore link to be a button instead since it's in a form. Changed user restore route to POST --- resources/views/partials/bootstrap-table.blade.php | 4 ++-- routes/web/users.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 2f019e7c1a..67ffafcdf6 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -282,7 +282,7 @@ if ((row.available_actions) && (row.available_actions.restore === true)) { actions += '
'; actions += '@csrf'; - actions += ' '; + actions += ' '; actions += '{{ trans('general.restore') }}
 '; } @@ -780,4 +780,4 @@ -@endpush +@endpush \ No newline at end of file diff --git a/routes/web/users.php b/routes/web/users.php index bc6cd32c67..06e71e8100 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -88,7 +88,7 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () { ] )->name('clone/user'); - Route::get( + Route::post( '{userId}/restore', [ Users\UsersController::class, @@ -175,4 +175,4 @@ Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () { Route::resource('users', Users\UsersController::class, [ 'middleware' => ['auth'], 'parameters' => ['user' => 'user_id'], -]); +]); \ No newline at end of file From 1650c9f8789d7007a10a2a949f22710a680d2c44 Mon Sep 17 00:00:00 2001 From: Mike Roquemore Date: Sat, 2 Jul 2022 13:28:17 -0500 Subject: [PATCH 2/6] Remove duplicate users routes --- routes/web/users.php | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/routes/web/users.php b/routes/web/users.php index 06e71e8100..773638fbc7 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -4,47 +4,7 @@ use App\Http\Controllers\Users; use App\Http\Controllers\Users\UserFilesController; use Illuminate\Support\Facades\Route; - // User Management - Route::post( - '{userId}/clone', - [ - Users\UsersController::class, - 'postCreate' - ] - ); - - Route::post( - '{userId}/restore', - [ - Users\UsersController::class, - 'getRestore' - ] - )->name('restore/user'); - - Route::get( - '{userId}/unsuspend', - [ - Users\UsersController::class, - 'getUnsuspend' - ] - )->name('unsuspend/user'); - - Route::post( - '{userId}/upload', - [ - Users\UserFilesController::class, - 'store' - ] - )->name('upload/user'); - - Route::delete( - '{userId}/deletefile/{fileId}', - [ - Users\UserFilesController::class, - 'destroy' - ] - )->name('userfile.destroy'); - +// User Management Route::group(['prefix' => 'users', 'middleware' => ['auth']], function () { From 07ac4087a351965d4989397aa9781cf80127cc2f Mon Sep 17 00:00:00 2001 From: Mike Roquemore Date: Sat, 2 Jul 2022 14:06:58 -0500 Subject: [PATCH 3/6] Remove link from alert since there is already a restore button on the side --- resources/views/users/view.blade.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index a6161f5197..c2c4266f9b 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -141,11 +141,6 @@
{{ trans('admin/users/message.user_deleted_warning') }} - @can('update', $user) - - {{ trans('admin/users/general.restore_user') }} - - @endcan
@endif @@ -220,7 +215,10 @@ @else
- {{ trans('button.restore') }} +
+ @csrf + +
@endif @endcan @@ -1032,4 +1030,4 @@ $(function () { -@stop +@stop \ No newline at end of file From 6e9f24c08f883b235365095fdefe2b15dec4dc4b Mon Sep 17 00:00:00 2001 From: Mike Roquemore Date: Sat, 2 Jul 2022 11:07:26 -0500 Subject: [PATCH 4/6] Change restore route to POST instead of GET --- routes/web/hardware.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/web/hardware.php b/routes/web/hardware.php index 22c4f0f20c..2ef3978946 100644 --- a/routes/web/hardware.php +++ b/routes/web/hardware.php @@ -134,7 +134,7 @@ Route::group( [AssetsController::class, 'getBarCode'] )->name('barcode/hardware'); - Route::get('{assetId}/restore', + Route::post('{assetId}/restore', [AssetsController::class, 'getRestore'] )->name('restore/hardware'); @@ -181,4 +181,4 @@ Route::resource('hardware', 'middleware' => ['auth'], 'parameters' => ['asset' => 'asset_id' ], -]); +]); \ No newline at end of file From 0a5ca6eb2510a7fef59155fe42660e7e40ce5f83 Mon Sep 17 00:00:00 2001 From: Mike Roquemore Date: Sat, 2 Jul 2022 11:07:26 -0500 Subject: [PATCH 5/6] Change restore route to POST instead of GET From afab167e8cdf4cc9391ed7d6dc6c375731fc218b Mon Sep 17 00:00:00 2001 From: snipe Date: Sat, 2 Jul 2022 13:08:46 -0700 Subject: [PATCH 6/6] Fixed restore button in listings Signed-off-by: snipe --- resources/views/partials/bootstrap-table.blade.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 67ffafcdf6..2b32c4d6f8 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -282,8 +282,7 @@ if ((row.available_actions) && (row.available_actions.restore === true)) { actions += '
'; actions += '@csrf'; - actions += ' '; - actions += '{{ trans('general.restore') }}
 '; + actions += ' '; } actions +='';