|
@@ -3,6 +3,7 @@
|
|
|
namespace Dcat\Admin\Grid\Displayers;
|
|
|
|
|
|
use Dcat\Admin\Support\Helper;
|
|
|
+use Illuminate\Support\Str;
|
|
|
|
|
|
class Modal extends AbstractDisplayer
|
|
|
{
|
|
@@ -13,6 +14,13 @@ class Modal extends AbstractDisplayer
|
|
|
$this->title = $title;
|
|
|
}
|
|
|
|
|
|
+ protected function generateElementId()
|
|
|
+ {
|
|
|
+ $key = $this->key() ?: Str::random(8);
|
|
|
+
|
|
|
+ return 'grid-modal-'.$this->grid->getName().$key;
|
|
|
+ }
|
|
|
+
|
|
|
public function display($callback = null)
|
|
|
{
|
|
|
$title = $this->trans('title');
|
|
@@ -28,14 +36,14 @@ class Modal extends AbstractDisplayer
|
|
|
}
|
|
|
|
|
|
$title = $this->title ?: $title;
|
|
|
- $key = $this->grid->getName().$this->key();
|
|
|
+ $id = $this->generateElementId();
|
|
|
|
|
|
return <<<EOT
|
|
|
-<span class="grid-expand" data-toggle="modal" data-target="#grid-modal-{$key}">
|
|
|
+<span class="grid-expand" data-toggle="modal" data-target="#{$id}">
|
|
|
<a href="javascript:void(0)"><i class="fa fa-clone"></i> {$this->value}</a>
|
|
|
</span>
|
|
|
|
|
|
-<div class="modal fade" id="grid-modal-{$key}" tabindex="-1" role="dialog">
|
|
|
+<div class="modal fade" id="{$id}" tabindex="-1" role="dialog">
|
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
|
<div class="modal-content">
|
|
|
<div class="modal-header">
|