From aeaff63cf43a623d7da8dac859bea739f888472e Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 22 Jan 2024 14:49:01 +0500 Subject: [PATCH 01/11] Add support for Grid's multiple callbacks for Actions --- src/Grid/Concerns/HasActions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Grid/Concerns/HasActions.php b/src/Grid/Concerns/HasActions.php index ab88e2bc..10b0c5bf 100644 --- a/src/Grid/Concerns/HasActions.php +++ b/src/Grid/Concerns/HasActions.php @@ -12,7 +12,7 @@ trait HasActions * * @var Closure */ - protected $actionsCallback; + protected $actionsCallback = []; /** * Actions column display class. @@ -31,7 +31,7 @@ trait HasActions public function actions($actions) { if ($actions instanceof Closure) { - $this->actionsCallback = $actions; + $this->actionsCallback[] = $actions; } return $this; @@ -119,6 +119,6 @@ protected function appendActionsColumn() } $this->addColumn(Grid\Column::ACTION_COLUMN_NAME, trans('admin.action')) - ->displayUsing($this->getActionClass(), [$this->actionsCallback]); + ->displayUsing($this->getActionClass(), $this->actionsCallback); } } From 41e6e7f1dc3350adb26d50c9b4026e0eb2b50ba7 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 22 Jan 2024 14:54:46 +0500 Subject: [PATCH 02/11] Created a HasRecycleBin Trait to be used in Controllers to display SoftDeletes as RecycleBin in Filters and show Restore and BatchRestore as actions. --- src/Controllers/HasRecycleBin.php | 34 +++++++++++++++++++++++++++++++ src/Grid/Actions/Restore.php | 25 +++++++++++++++++++++++ src/Grid/Tools/BatchRestore.php | 26 +++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 src/Controllers/HasRecycleBin.php create mode 100644 src/Grid/Actions/Restore.php create mode 100644 src/Grid/Tools/BatchRestore.php diff --git a/src/Controllers/HasRecycleBin.php b/src/Controllers/HasRecycleBin.php new file mode 100644 index 00000000..6518bdd7 --- /dev/null +++ b/src/Controllers/HasRecycleBin.php @@ -0,0 +1,34 @@ +registerHook('alterGrid', function ($controller, $grid) { + $grid->filter(function($filter) { + $filter->scope('trashed', 'Recycle Bin')->onlyTrashed(); + }); + + $grid->actions(function ($actions) { + if (request('_scope_') == 'trashed') { + $actions->add(new Restore()); + } + return $actions; + }); + + $grid->batchActions (function($batch) { + if (request('_scope_') == 'trashed') { + $batch->add(new BatchRestore()); + } + }); + + return $grid; + }); + } +} diff --git a/src/Grid/Actions/Restore.php b/src/Grid/Actions/Restore.php new file mode 100644 index 00000000..0fae6fd5 --- /dev/null +++ b/src/Grid/Actions/Restore.php @@ -0,0 +1,25 @@ +restore(); + return $this->response()->success('Restored Successfully')->refresh(); + } + + public function dialog() + { + $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + } +} diff --git a/src/Grid/Tools/BatchRestore.php b/src/Grid/Tools/BatchRestore.php new file mode 100644 index 00000000..fdc4b207 --- /dev/null +++ b/src/Grid/Tools/BatchRestore.php @@ -0,0 +1,26 @@ +restore(); + } + + return $this->response()->success('Restored Successfully')->refresh(); + } + + public function dialog() + { + $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + } +} From 5a21802f556f6fc6018b2a8ed8455612cbee1d98 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 22 Jan 2024 15:47:28 +0500 Subject: [PATCH 03/11] Code Style Fixes --- src/Controllers/HasRecycleBin.php | 7 ++++--- src/Grid/Actions/Restore.php | 2 +- src/Grid/Tools/BatchRestore.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Controllers/HasRecycleBin.php b/src/Controllers/HasRecycleBin.php index 6518bdd7..67eca028 100644 --- a/src/Controllers/HasRecycleBin.php +++ b/src/Controllers/HasRecycleBin.php @@ -7,11 +7,12 @@ trait HasRecycleBin { - public function __construct() { + public function __construct() + { // register hooks $this->registerHook('alterGrid', function ($controller, $grid) { - $grid->filter(function($filter) { + $grid->filter(function ($filter) { $filter->scope('trashed', 'Recycle Bin')->onlyTrashed(); }); @@ -22,7 +23,7 @@ public function __construct() { return $actions; }); - $grid->batchActions (function($batch) { + $grid->batchActions (function ($batch) { if (request('_scope_') == 'trashed') { $batch->add(new BatchRestore()); } diff --git a/src/Grid/Actions/Restore.php b/src/Grid/Actions/Restore.php index 0fae6fd5..7ac32830 100644 --- a/src/Grid/Actions/Restore.php +++ b/src/Grid/Actions/Restore.php @@ -20,6 +20,6 @@ public function handle(Model $model): Response public function dialog() { - $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); } } diff --git a/src/Grid/Tools/BatchRestore.php b/src/Grid/Tools/BatchRestore.php index fdc4b207..b0275bbb 100644 --- a/src/Grid/Tools/BatchRestore.php +++ b/src/Grid/Tools/BatchRestore.php @@ -21,6 +21,6 @@ public function handle(Collection $collection) public function dialog() { - $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); } } From 30886883f632affacc2a1d43fabe0daa37fcd4d8 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 22 Jan 2024 15:47:28 +0500 Subject: [PATCH 04/11] Code Style Fixes --- src/Controllers/HasRecycleBin.php | 8 +++++--- src/Grid/Actions/Restore.php | 3 ++- src/Grid/Tools/BatchRestore.php | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Controllers/HasRecycleBin.php b/src/Controllers/HasRecycleBin.php index 6518bdd7..673d5732 100644 --- a/src/Controllers/HasRecycleBin.php +++ b/src/Controllers/HasRecycleBin.php @@ -7,11 +7,12 @@ trait HasRecycleBin { - public function __construct() { + public function __construct() + { // register hooks $this->registerHook('alterGrid', function ($controller, $grid) { - $grid->filter(function($filter) { + $grid->filter(function ($filter) { $filter->scope('trashed', 'Recycle Bin')->onlyTrashed(); }); @@ -19,10 +20,11 @@ public function __construct() { if (request('_scope_') == 'trashed') { $actions->add(new Restore()); } + return $actions; }); - $grid->batchActions (function($batch) { + $grid->batchActions(function ($batch) { if (request('_scope_') == 'trashed') { $batch->add(new BatchRestore()); } diff --git a/src/Grid/Actions/Restore.php b/src/Grid/Actions/Restore.php index 0fae6fd5..12f73b98 100644 --- a/src/Grid/Actions/Restore.php +++ b/src/Grid/Actions/Restore.php @@ -15,11 +15,12 @@ public function handle(Model $model): Response { // $model ... $model->restore(); + return $this->response()->success('Restored Successfully')->refresh(); } public function dialog() { - $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); } } diff --git a/src/Grid/Tools/BatchRestore.php b/src/Grid/Tools/BatchRestore.php index fdc4b207..b0275bbb 100644 --- a/src/Grid/Tools/BatchRestore.php +++ b/src/Grid/Tools/BatchRestore.php @@ -21,6 +21,6 @@ public function handle(Collection $collection) public function dialog() { - $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question','confirmButtonText'=>'Yes']); + $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); } } From ba54ee3d8f045a6497785aa076eb7cbd4dadd628 Mon Sep 17 00:00:00 2001 From: Aatif Farooq Date: Mon, 22 Jan 2024 18:47:32 +0500 Subject: [PATCH 05/11] Fixed the Delete Response to be the actual server's response. --- resources/assets/open-admin/js/open-admin-resource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/open-admin/js/open-admin-resource.js b/resources/assets/open-admin/js/open-admin-resource.js index 615cd285..391e75bd 100644 --- a/resources/assets/open-admin/js/open-admin-resource.js +++ b/resources/assets/open-admin/js/open-admin-resource.js @@ -33,7 +33,7 @@ let url = resource_url; let data = {_method:'delete'}; admin.ajax.post(url,data,function(data){ - resolve(data); + resolve(data.data); if (navigate_url){ admin.ajax.navigate(navigate_url); }else{ From e355702b592b8bb27586f85860f594d69a92196e Mon Sep 17 00:00:00 2001 From: Aatif Farooq Date: Mon, 22 Jan 2024 21:58:47 +0500 Subject: [PATCH 06/11] Multiple Callbacks Fix for Actions on Grid. --- src/Grid/Concerns/HasActions.php | 4 ++-- src/Grid/Displayers/Actions/Actions.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Grid/Concerns/HasActions.php b/src/Grid/Concerns/HasActions.php index 10b0c5bf..7f94301f 100644 --- a/src/Grid/Concerns/HasActions.php +++ b/src/Grid/Concerns/HasActions.php @@ -52,7 +52,7 @@ public function getActionClass() return $class; } - return Grid\Displayers\Acions\Actions::class; + return Grid\Displayers\Actions\Actions::class; } /** @@ -119,6 +119,6 @@ protected function appendActionsColumn() } $this->addColumn(Grid\Column::ACTION_COLUMN_NAME, trans('admin.action')) - ->displayUsing($this->getActionClass(), $this->actionsCallback); + ->displayUsing($this->getActionClass(), [$this->actionsCallback]); } } diff --git a/src/Grid/Displayers/Actions/Actions.php b/src/Grid/Displayers/Actions/Actions.php index 8d86c73f..0d92fed7 100644 --- a/src/Grid/Displayers/Actions/Actions.php +++ b/src/Grid/Displayers/Actions/Actions.php @@ -242,6 +242,14 @@ public function display($callback = null) $callback->call($this, $this); } + if(is_array($callback)) { + foreach ($callback as $instance) { + if($instance instanceof \Closure) { + $instance->call($this, $this); + } + } + } + if ($this->disableAll) { return ''; } From 229534b85a4b276321512973091223f40a3e4390 Mon Sep 17 00:00:00 2001 From: Aatif Farooq Date: Mon, 22 Jan 2024 21:59:34 +0500 Subject: [PATCH 07/11] Added the Tooltip on Action Icons --- src/Actions/RowAction.php | 7 +++++-- src/Grid/Actions/Delete.php | 6 ++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Actions/RowAction.php b/src/Actions/RowAction.php index d51d40f3..d32fd940 100644 --- a/src/Actions/RowAction.php +++ b/src/Actions/RowAction.php @@ -134,16 +134,19 @@ public function display($value) */ public function render() { + $this->attribute('title', $this->name()); + $attributes = $this->formatAttributes(); + $linkClass = ($this->parent->getActionClass() != "OpenAdmin\Admin\Grid\Displayers\Actions\Actions") ? 'dropdown-item' : ''; $icon = $this->getIcon(); if ($href = $this->href()) { - return "{$icon}{$this->name()}"; + return "{$icon}{$this->name()}"; } $this->addScript(); - $attributes = $this->formatAttributes(); + $attributes = $this->formatAttributes(); // fetch again to get script attributes return sprintf( "{$icon}%s", diff --git a/src/Grid/Actions/Delete.php b/src/Grid/Actions/Delete.php index 7632b413..1a3cb6f4 100644 --- a/src/Grid/Actions/Delete.php +++ b/src/Grid/Actions/Delete.php @@ -21,10 +21,8 @@ public function name() public function addScript() { - $this->attributes = [ - 'onclick' => 'admin.resource.delete(event,this)', - 'data-url'=> "{$this->getResource()}/{$this->getKey()}", - ]; + $this->attribute('onclick', 'admin.resource.delete(event,this)'); + $this->attribute('data-url', "{$this->getResource()}/{$this->getKey()}"); } /* From b6ab3b1fa7e33c858e986f890d5aa60375afbcd1 Mon Sep 17 00:00:00 2001 From: Aatif Farooq Date: Mon, 22 Jan 2024 22:00:25 +0500 Subject: [PATCH 08/11] BugFix Sweet Alert Object - Expecting icon not type. --- src/Actions/SweatAlert2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Actions/SweatAlert2.php b/src/Actions/SweatAlert2.php index 09cf4a7f..34e973fd 100644 --- a/src/Actions/SweatAlert2.php +++ b/src/Actions/SweatAlert2.php @@ -35,7 +35,7 @@ public function getOptions() { return [ 'swal' => [ - 'type' => $this->type, + 'icon' => $this->type, 'title' => $this->title, ], ]; From 4e49bd456c86c0dafc7e1165e33f2e4452e8d9fe Mon Sep 17 00:00:00 2001 From: Aatif Farooq Date: Mon, 22 Jan 2024 22:59:08 +0500 Subject: [PATCH 09/11] Added to Translation Files --- resources/lang/en/admin.php | 211 +++++++++++++++--------------- src/Controllers/HasRecycleBin.php | 2 +- src/Grid/Actions/Restore.php | 11 +- src/Grid/Tools/BatchRestore.php | 11 +- 4 files changed, 126 insertions(+), 109 deletions(-) diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index 4bda990b..dbe498c7 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -1,113 +1,120 @@ 'Online', - 'login' => 'Login', - 'logout' => 'Logout', - 'setting' => 'Setting', - 'name' => 'Name', - 'username' => 'Username', - 'password' => 'Password', + 'online' => 'Online', + 'login' => 'Login', + 'logout' => 'Logout', + 'setting' => 'Setting', + 'name' => 'Name', + 'username' => 'Username', + 'password' => 'Password', 'password_confirmation' => 'Password confirmation', - 'remember_me' => 'Remember me', - 'user_setting' => 'User setting', - 'avatar' => 'Avatar', - 'list' => 'List', - 'new' => 'New', - 'create' => 'Create', - 'delete' => 'Delete', - 'remove' => 'Remove', - 'edit' => 'Edit', - 'view' => 'View', - 'continue_editing' => 'Continue editing', - 'continue_creating' => 'Continue creating', - 'detail' => 'Detail', - 'browse' => 'Browse', - 'reset' => 'Reset', - 'export' => 'Export', - 'batch_delete' => 'Batch delete', - 'batch_edit' => 'Batch edit', - 'save' => 'Save', - 'refresh' => 'Refresh', - 'order' => 'Order', - 'expand' => 'Expand', - 'collapse' => 'Collapse', - 'filter' => 'Filter', - 'search' => 'Search', - 'close' => 'Close', - 'show' => 'Show', - 'entries' => 'entries', - 'captcha' => 'Captcha', - 'action' => 'Action', - 'title' => 'Title', - 'description' => 'Description', - 'back' => 'Back', - 'back_to_list' => 'Back to List', - 'submit' => 'Submit', - 'menu' => 'Menu', - 'input' => 'Input', - 'succeeded' => 'Succeeded', - 'failed' => 'Failed', - 'delete_confirm' => 'Are you sure to delete this item ?', - 'delete_succeeded' => 'Delete succeeded !', - 'delete_failed' => 'Delete failed !', - 'delete_file_on_save' => 'Are you sure you want to delete this file after saving?', - 'update_succeeded' => 'Update succeeded !', - 'save_succeeded' => 'Save succeeded !', - 'refresh_succeeded' => 'Refresh succeeded !', - 'login_successful' => 'Login successful', - 'select' => 'Select', - 'choose' => 'Choose', - 'choose_file' => 'Select file', - 'choose_image' => 'Select image', - 'more' => 'More', - 'deny' => 'Permission denied', - 'administrator' => 'Administrator', - 'roles' => 'Roles', - 'permissions' => 'Permissions', - 'slug' => 'Slug', - 'created_at' => 'Created At', - 'updated_at' => 'Updated At', - 'alert' => 'Alert', - 'parent_id' => 'Parent', - 'icon' => 'Icon', - 'uri' => 'URI', - 'operation_log' => 'Operation log', - 'parent_select_error' => 'Parent select error', - 'pagination' => [ + 'remember_me' => 'Remember me', + 'user_setting' => 'User setting', + 'avatar' => 'Avatar', + 'list' => 'List', + 'new' => 'New', + 'create' => 'Create', + 'delete' => 'Delete', + 'remove' => 'Remove', + 'edit' => 'Edit', + 'view' => 'View', + 'continue_editing' => 'Continue editing', + 'continue_creating' => 'Continue creating', + 'detail' => 'Detail', + 'browse' => 'Browse', + 'reset' => 'Reset', + 'export' => 'Export', + 'batch_delete' => 'Batch delete', + 'batch_edit' => 'Batch edit', + 'save' => 'Save', + 'refresh' => 'Refresh', + 'order' => 'Order', + 'expand' => 'Expand', + 'collapse' => 'Collapse', + 'filter' => 'Filter', + 'search' => 'Search', + 'close' => 'Close', + 'show' => 'Show', + 'entries' => 'entries', + 'captcha' => 'Captcha', + 'action' => 'Action', + 'title' => 'Title', + 'description' => 'Description', + 'back' => 'Back', + 'back_to_list' => 'Back to List', + 'submit' => 'Submit', + 'menu' => 'Menu', + 'input' => 'Input', + 'succeeded' => 'Succeeded', + 'failed' => 'Failed', + 'delete_confirm' => 'Are you sure to delete this item ?', + 'delete_succeeded' => 'Delete succeeded !', + 'delete_failed' => 'Delete failed !', + 'delete_file_on_save' => 'Are you sure you want to delete this file after saving?', + 'update_succeeded' => 'Update succeeded !', + 'save_succeeded' => 'Save succeeded !', + 'refresh_succeeded' => 'Refresh succeeded !', + 'login_successful' => 'Login successful', + 'select' => 'Select', + 'choose' => 'Choose', + 'choose_file' => 'Select file', + 'choose_image' => 'Select image', + 'more' => 'More', + 'deny' => 'Permission denied', + 'administrator' => 'Administrator', + 'roles' => 'Roles', + 'permissions' => 'Permissions', + 'slug' => 'Slug', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + 'alert' => 'Alert', + 'parent_id' => 'Parent', + 'icon' => 'Icon', + 'uri' => 'URI', + 'operation_log' => 'Operation log', + 'parent_select_error' => 'Parent select error', + 'pagination' => [ 'range' => 'Showing :first to :last of :total entries', ], - 'role' => 'Role', - 'permission' => 'Permission', - 'route' => 'Route', - 'confirm' => 'Confirm', - 'cancel' => 'Cancel', - 'http' => [ + 'role' => 'Role', + 'permission' => 'Permission', + 'route' => 'Route', + 'confirm' => 'Confirm', + 'cancel' => 'Cancel', + 'http' => [ 'method' => 'HTTP method', - 'path' => 'HTTP path', + 'path' => 'HTTP path', ], - 'all_methods_if_empty' => 'All methods if empty', - 'all' => 'All', - 'current_page' => 'Current page', - 'selected_rows' => 'Selected rows', - 'no_rows_selected' => 'No Row Selected', - 'upload' => 'Upload', - 'new_folder' => 'New folder', - 'time' => 'Time', - 'size' => 'Size', - 'listbox' => [ - 'title_available' => 'Available', - 'title_selected' => 'Selected', - 'text_total' => 'Showing all {0}', - 'text_empty' => 'Empty list', - 'filtered' => '{0} / {1}', - 'filter_clear' => 'Show all', - 'filter_placeholder' => 'Filter', + 'all_methods_if_empty' => 'All methods if empty', + 'all' => 'All', + 'current_page' => 'Current page', + 'selected_rows' => 'Selected rows', + 'no_rows_selected' => 'No Row Selected', + 'upload' => 'Upload', + 'new_folder' => 'New folder', + 'time' => 'Time', + 'size' => 'Size', + 'listbox' => [ + 'title_available' => 'Available', + 'title_selected' => 'Selected', + 'text_total' => 'Showing all {0}', + 'text_empty' => 'Empty list', + 'filtered' => '{0} / {1}', + 'filter_clear' => 'Show all', + 'filter_placeholder' => 'Filter', ], - 'grid_items_selected' => '{n} items selected', + 'grid_items_selected' => '{n} items selected', - 'menu_titles' => [], - 'prev' => 'Prev', - 'next' => 'Next', - 'quick_create' => 'Quick create', + 'menu_titles' => [], + 'prev' => 'Prev', + 'next' => 'Next', + 'quick_create' => 'Quick create', + 'restore_confirm' => 'Are you sure, you want to restore?', + 'yes' => 'Yes', + 'restore_success' => 'Restored Successfully', + 'restore' => 'Restore', + 'batch_restore' => 'Batch Restore', + 'batch_restore_confirm' => 'Are you sure, you want to restore all selected?', + 'recyclebin' => 'Recycle Bin', ]; diff --git a/src/Controllers/HasRecycleBin.php b/src/Controllers/HasRecycleBin.php index 673d5732..17aa0d22 100644 --- a/src/Controllers/HasRecycleBin.php +++ b/src/Controllers/HasRecycleBin.php @@ -13,7 +13,7 @@ public function __construct() $this->registerHook('alterGrid', function ($controller, $grid) { $grid->filter(function ($filter) { - $filter->scope('trashed', 'Recycle Bin')->onlyTrashed(); + $filter->scope('trashed', __('admin.recyclebin'))->onlyTrashed(); }); $grid->actions(function ($actions) { diff --git a/src/Grid/Actions/Restore.php b/src/Grid/Actions/Restore.php index 12f73b98..810c29f5 100644 --- a/src/Grid/Actions/Restore.php +++ b/src/Grid/Actions/Restore.php @@ -8,19 +8,24 @@ class Restore extends RowAction { - public $name = 'Restore'; + public $name = ''; public $icon = 'icon-trash-restore'; + public function name() + { + return $this->name = __('admin.restore'); + } + public function handle(Model $model): Response { // $model ... $model->restore(); - return $this->response()->success('Restored Successfully')->refresh(); + return $this->response()->success(__('admin.restore_success'))->refresh(); } public function dialog() { - $this->confirm('Are you sure, you want to restore?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); + $this->confirm(__('admin.restore_confirm'), '', ['icon'=>'question', 'confirmButtonText'=>__('admin.yes')]); } } diff --git a/src/Grid/Tools/BatchRestore.php b/src/Grid/Tools/BatchRestore.php index b0275bbb..d304d569 100644 --- a/src/Grid/Tools/BatchRestore.php +++ b/src/Grid/Tools/BatchRestore.php @@ -7,20 +7,25 @@ class BatchRestore extends BatchAction { - public $name = 'Batch Restore'; + public $name = ''; public $icon = 'icon-trash-restore'; + public function name() + { + return $this->name = __('admin.batch_restore'); + } + public function handle(Collection $collection) { foreach ($collection as $model) { $model->restore(); } - return $this->response()->success('Restored Successfully')->refresh(); + return $this->response()->success(__('admin.restore_success'))->refresh(); } public function dialog() { - $this->confirm('Are you sure, you want to restore all selected?', '', ['icon'=>'question', 'confirmButtonText'=>'Yes']); + $this->confirm(__('admin.batch_restore_confirm'), '', ['icon'=>'question', 'confirmButtonText'=>__('admin.yes')]); } } From 5aa5c4cbbd74002aff8f29870f79a0cda54bc60f Mon Sep 17 00:00:00 2001 From: = <=> Date: Tue, 23 Jan 2024 11:04:50 +0500 Subject: [PATCH 10/11] Language file Code Formatting fix --- resources/lang/en/admin.php | 214 ++++++++++++++++++------------------ 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index dbe498c7..1492139b 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -1,120 +1,120 @@ 'Online', - 'login' => 'Login', - 'logout' => 'Logout', - 'setting' => 'Setting', - 'name' => 'Name', - 'username' => 'Username', - 'password' => 'Password', + 'online' => 'Online', + 'login' => 'Login', + 'logout' => 'Logout', + 'setting' => 'Setting', + 'name' => 'Name', + 'username' => 'Username', + 'password' => 'Password', 'password_confirmation' => 'Password confirmation', - 'remember_me' => 'Remember me', - 'user_setting' => 'User setting', - 'avatar' => 'Avatar', - 'list' => 'List', - 'new' => 'New', - 'create' => 'Create', - 'delete' => 'Delete', - 'remove' => 'Remove', - 'edit' => 'Edit', - 'view' => 'View', - 'continue_editing' => 'Continue editing', - 'continue_creating' => 'Continue creating', - 'detail' => 'Detail', - 'browse' => 'Browse', - 'reset' => 'Reset', - 'export' => 'Export', - 'batch_delete' => 'Batch delete', - 'batch_edit' => 'Batch edit', - 'save' => 'Save', - 'refresh' => 'Refresh', - 'order' => 'Order', - 'expand' => 'Expand', - 'collapse' => 'Collapse', - 'filter' => 'Filter', - 'search' => 'Search', - 'close' => 'Close', - 'show' => 'Show', - 'entries' => 'entries', - 'captcha' => 'Captcha', - 'action' => 'Action', - 'title' => 'Title', - 'description' => 'Description', - 'back' => 'Back', - 'back_to_list' => 'Back to List', - 'submit' => 'Submit', - 'menu' => 'Menu', - 'input' => 'Input', - 'succeeded' => 'Succeeded', - 'failed' => 'Failed', - 'delete_confirm' => 'Are you sure to delete this item ?', - 'delete_succeeded' => 'Delete succeeded !', - 'delete_failed' => 'Delete failed !', - 'delete_file_on_save' => 'Are you sure you want to delete this file after saving?', - 'update_succeeded' => 'Update succeeded !', - 'save_succeeded' => 'Save succeeded !', - 'refresh_succeeded' => 'Refresh succeeded !', - 'login_successful' => 'Login successful', - 'select' => 'Select', - 'choose' => 'Choose', - 'choose_file' => 'Select file', - 'choose_image' => 'Select image', - 'more' => 'More', - 'deny' => 'Permission denied', - 'administrator' => 'Administrator', - 'roles' => 'Roles', - 'permissions' => 'Permissions', - 'slug' => 'Slug', - 'created_at' => 'Created At', - 'updated_at' => 'Updated At', - 'alert' => 'Alert', - 'parent_id' => 'Parent', - 'icon' => 'Icon', - 'uri' => 'URI', - 'operation_log' => 'Operation log', - 'parent_select_error' => 'Parent select error', - 'pagination' => [ + 'remember_me' => 'Remember me', + 'user_setting' => 'User setting', + 'avatar' => 'Avatar', + 'list' => 'List', + 'new' => 'New', + 'create' => 'Create', + 'delete' => 'Delete', + 'remove' => 'Remove', + 'edit' => 'Edit', + 'view' => 'View', + 'continue_editing' => 'Continue editing', + 'continue_creating' => 'Continue creating', + 'detail' => 'Detail', + 'browse' => 'Browse', + 'reset' => 'Reset', + 'export' => 'Export', + 'batch_delete' => 'Batch delete', + 'batch_edit' => 'Batch edit', + 'save' => 'Save', + 'refresh' => 'Refresh', + 'order' => 'Order', + 'expand' => 'Expand', + 'collapse' => 'Collapse', + 'filter' => 'Filter', + 'search' => 'Search', + 'close' => 'Close', + 'show' => 'Show', + 'entries' => 'entries', + 'captcha' => 'Captcha', + 'action' => 'Action', + 'title' => 'Title', + 'description' => 'Description', + 'back' => 'Back', + 'back_to_list' => 'Back to List', + 'submit' => 'Submit', + 'menu' => 'Menu', + 'input' => 'Input', + 'succeeded' => 'Succeeded', + 'failed' => 'Failed', + 'delete_confirm' => 'Are you sure to delete this item ?', + 'delete_succeeded' => 'Delete succeeded !', + 'delete_failed' => 'Delete failed !', + 'delete_file_on_save' => 'Are you sure you want to delete this file after saving?', + 'update_succeeded' => 'Update succeeded !', + 'save_succeeded' => 'Save succeeded !', + 'refresh_succeeded' => 'Refresh succeeded !', + 'login_successful' => 'Login successful', + 'select' => 'Select', + 'choose' => 'Choose', + 'choose_file' => 'Select file', + 'choose_image' => 'Select image', + 'more' => 'More', + 'deny' => 'Permission denied', + 'administrator' => 'Administrator', + 'roles' => 'Roles', + 'permissions' => 'Permissions', + 'slug' => 'Slug', + 'created_at' => 'Created At', + 'updated_at' => 'Updated At', + 'alert' => 'Alert', + 'parent_id' => 'Parent', + 'icon' => 'Icon', + 'uri' => 'URI', + 'operation_log' => 'Operation log', + 'parent_select_error' => 'Parent select error', + 'pagination' => [ 'range' => 'Showing :first to :last of :total entries', ], - 'role' => 'Role', - 'permission' => 'Permission', - 'route' => 'Route', - 'confirm' => 'Confirm', - 'cancel' => 'Cancel', - 'http' => [ + 'role' => 'Role', + 'permission' => 'Permission', + 'route' => 'Route', + 'confirm' => 'Confirm', + 'cancel' => 'Cancel', + 'http' => [ 'method' => 'HTTP method', - 'path' => 'HTTP path', + 'path' => 'HTTP path', ], - 'all_methods_if_empty' => 'All methods if empty', - 'all' => 'All', - 'current_page' => 'Current page', - 'selected_rows' => 'Selected rows', - 'no_rows_selected' => 'No Row Selected', - 'upload' => 'Upload', - 'new_folder' => 'New folder', - 'time' => 'Time', - 'size' => 'Size', - 'listbox' => [ - 'title_available' => 'Available', - 'title_selected' => 'Selected', - 'text_total' => 'Showing all {0}', - 'text_empty' => 'Empty list', - 'filtered' => '{0} / {1}', - 'filter_clear' => 'Show all', + 'all_methods_if_empty' => 'All methods if empty', + 'all' => 'All', + 'current_page' => 'Current page', + 'selected_rows' => 'Selected rows', + 'no_rows_selected' => 'No Row Selected', + 'upload' => 'Upload', + 'new_folder' => 'New folder', + 'time' => 'Time', + 'size' => 'Size', + 'listbox' => [ + 'title_available' => 'Available', + 'title_selected' => 'Selected', + 'text_total' => 'Showing all {0}', + 'text_empty' => 'Empty list', + 'filtered' => '{0} / {1}', + 'filter_clear' => 'Show all', 'filter_placeholder' => 'Filter', ], - 'grid_items_selected' => '{n} items selected', + 'grid_items_selected' => '{n} items selected', - 'menu_titles' => [], - 'prev' => 'Prev', - 'next' => 'Next', - 'quick_create' => 'Quick create', - 'restore_confirm' => 'Are you sure, you want to restore?', - 'yes' => 'Yes', - 'restore_success' => 'Restored Successfully', - 'restore' => 'Restore', - 'batch_restore' => 'Batch Restore', + 'menu_titles' => [], + 'prev' => 'Prev', + 'next' => 'Next', + 'quick_create' => 'Quick create', + 'restore_confirm' => 'Are you sure, you want to restore?', + 'yes' => 'Yes', + 'restore_success' => 'Restored Successfully', + 'restore' => 'Restore', + 'batch_restore' => 'Batch Restore', 'batch_restore_confirm' => 'Are you sure, you want to restore all selected?', - 'recyclebin' => 'Recycle Bin', + 'recyclebin' => 'Recycle Bin', ]; From 19c211e71c8a029eb86e0f5f7fcd93dd05547f64 Mon Sep 17 00:00:00 2001 From: Aatif SCI Date: Tue, 23 Jan 2024 13:12:40 +0500 Subject: [PATCH 11/11] Recycle Bin View Remove UnUsable Actions --- src/Controllers/HasRecycleBin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Controllers/HasRecycleBin.php b/src/Controllers/HasRecycleBin.php index 17aa0d22..d8251759 100644 --- a/src/Controllers/HasRecycleBin.php +++ b/src/Controllers/HasRecycleBin.php @@ -19,6 +19,8 @@ public function __construct() $grid->actions(function ($actions) { if (request('_scope_') == 'trashed') { $actions->add(new Restore()); + $actions->disableView(); + $actions->disableEdit(); } return $actions;