|
@@ -3,7 +3,6 @@
|
|
|
namespace Dcat\Admin\Grid\Displayers;
|
|
|
|
|
|
use Dcat\Admin\Actions\Action;
|
|
|
-use Dcat\Admin\Form;
|
|
|
use Dcat\Admin\Grid\Actions\Delete;
|
|
|
use Dcat\Admin\Grid\Actions\Edit;
|
|
|
use Dcat\Admin\Grid\Actions\QuickEdit;
|
|
@@ -15,8 +14,6 @@ use Illuminate\Contracts\Support\Renderable;
|
|
|
|
|
|
class Actions extends AbstractDisplayer
|
|
|
{
|
|
|
- protected static $resolvedDialog;
|
|
|
-
|
|
|
/**
|
|
|
* @var array
|
|
|
*/
|
|
@@ -251,16 +248,22 @@ class Actions extends AbstractDisplayer
|
|
|
*/
|
|
|
protected function renderView()
|
|
|
{
|
|
|
- $label = trans('admin.show');
|
|
|
-
|
|
|
- return Show::make(
|
|
|
- "<i title='{$label}' class=\"feather icon-eye grid-action-icon\"></i> "
|
|
|
- )
|
|
|
+ return Show::make($this->getViewLabel())
|
|
|
->setGrid($this->grid)
|
|
|
->setRow($this->row)
|
|
|
->render();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function getViewLabel()
|
|
|
+ {
|
|
|
+ $label = trans('admin.show');
|
|
|
+
|
|
|
+ return "<i title='{$label}' class=\"feather icon-eye grid-action-icon\"></i> ";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Render edit action.
|
|
|
*
|
|
@@ -268,11 +271,7 @@ class Actions extends AbstractDisplayer
|
|
|
*/
|
|
|
protected function renderEdit()
|
|
|
{
|
|
|
- $label = trans('admin.edit');
|
|
|
-
|
|
|
- return Edit::make(
|
|
|
- "<i title='{$label}' class=\"feather icon-edit-1 grid-action-icon\"></i> "
|
|
|
- )
|
|
|
+ return Edit::make($this->getEditLabel())
|
|
|
->setGrid($this->grid)
|
|
|
->setRow($this->row)
|
|
|
->render();
|
|
@@ -281,29 +280,34 @@ class Actions extends AbstractDisplayer
|
|
|
/**
|
|
|
* @return string
|
|
|
*/
|
|
|
- protected function renderQuickEdit()
|
|
|
+ protected function getEditLabel()
|
|
|
{
|
|
|
- if (! static::$resolvedDialog) {
|
|
|
- static::$resolvedDialog = true;
|
|
|
-
|
|
|
- [$width, $height] = $this->grid->option('dialog_form_area');
|
|
|
-
|
|
|
- Form::dialog(trans('admin.edit'))
|
|
|
- ->click(".{$this->grid->getRowName()}-edit")
|
|
|
- ->dimensions($width, $height)
|
|
|
- ->success('Dcat.reload()');
|
|
|
- }
|
|
|
+ $label = trans('admin.show');
|
|
|
|
|
|
- $label = trans('admin.quick_edit');
|
|
|
+ return "<i title='{$label}' class=\"feather icon-edit-1 grid-action-icon\"></i> ";
|
|
|
+ }
|
|
|
|
|
|
- return QuickEdit::make(
|
|
|
- "<i title='{$label}' class=\"feather icon-edit grid-action-icon\"></i> "
|
|
|
- )
|
|
|
+ /**
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function renderQuickEdit()
|
|
|
+ {
|
|
|
+ return QuickEdit::make($this->getQuickEditLabel())
|
|
|
->setGrid($this->grid)
|
|
|
->setRow($this->row)
|
|
|
->render();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function getQuickEditLabel()
|
|
|
+ {
|
|
|
+ $label = trans('admin.quick_edit');
|
|
|
+
|
|
|
+ return "<i title='{$label}' class=\"feather icon-edit grid-action-icon\"></i> ";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Render delete action.
|
|
|
*
|
|
@@ -311,13 +315,19 @@ class Actions extends AbstractDisplayer
|
|
|
*/
|
|
|
protected function renderDelete()
|
|
|
{
|
|
|
- $label = trans('admin.delete');
|
|
|
-
|
|
|
- return Delete::make(
|
|
|
- "<i class=\"feather icon-trash grid-action-icon\" title='{$label}'></i> "
|
|
|
- )
|
|
|
+ return Delete::make($this->getDeleteLabel())
|
|
|
->setGrid($this->grid)
|
|
|
->setRow($this->row)
|
|
|
->render();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ protected function getDeleteLabel()
|
|
|
+ {
|
|
|
+ $label = trans('admin.delete');
|
|
|
+
|
|
|
+ return "<i class=\"feather icon-trash grid-action-icon\" title='{$label}'></i> ";
|
|
|
+ }
|
|
|
}
|