Browse Source

batchaction divider

jqh 3 years ago
parent
commit
0e2e72d371

+ 7 - 3
resources/views/grid/batch-actions.blade.php

@@ -7,9 +7,13 @@
     </button>
     <ul class="dropdown-menu" role="menu">
         @foreach($actions as $action)
-            <li class="dropdown-item">
-                {!! $action->render() !!}
-            </li>
+            @if ($action instanceof Dcat\Admin\Grid\Tools\ActionDivider)
+                <li class="dropdown-divider"></li>
+            @else
+                <li class="dropdown-item">
+                    {!! $action->render() !!}
+                </li>
+            @endif
         @endforeach
     </ul>
 </div>

+ 13 - 0
src/Grid/Tools/ActionDivider.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace Dcat\Admin\Grid\Tools;
+
+use Dcat\Admin\Grid\BatchAction;
+
+class ActionDivider extends BatchAction
+{
+    public function render()
+    {
+        return '';
+    }
+}

+ 5 - 0
src/Grid/Tools/BatchActions.php

@@ -69,6 +69,11 @@ class BatchActions extends AbstractTool
         return $this;
     }
 
+    public function divider()
+    {
+        return $this->add(new ActionDivider());
+    }
+
     /**
      * Disable delete And Hide SelectAll Checkbox.
      *