QuickEdit.php 998 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace Dcat\Admin\Grid\Actions;
  3. use Dcat\Admin\Form;
  4. use Dcat\Admin\Grid\RowAction;
  5. class QuickEdit extends RowAction
  6. {
  7. protected static $resolvedWindow;
  8. /**
  9. * @return array|null|string
  10. */
  11. public function title()
  12. {
  13. return __('admin.quick_edit');
  14. }
  15. public function render()
  16. {
  17. if (! static::$resolvedWindow) {
  18. static::$resolvedWindow = true;
  19. [$width, $height] = $this->parent->option('dialog_form_area');
  20. $title = trans('admin.edit').' - '.$this->key();
  21. Form::modal($title)
  22. ->click(".{$this->elementClass()}")
  23. ->dimensions($width, $height)
  24. ->forceRefresh()
  25. ->success('LA.reload()')
  26. ->render();
  27. }
  28. $this->setHtmlAttribute([
  29. 'data-url' => "{$this->resource()}/{$this->key()}/edit",
  30. ]);
  31. return parent::render(); // TODO: Change the autogenerated stub
  32. }
  33. }