jqh 5 yıl önce
ebeveyn
işleme
6430eaaf3e

+ 1 - 1
resources/views/dashboard/title.blade.php

@@ -36,7 +36,7 @@
 
             <div class="text-center mb-1">
                 <h1 class="mb-3 mt-2 white">Dcat Admin</h1>
-                <div class="links mb-2">
+                <div class="links mb-3">
                     <a href="https://github.com/jqhph/dcat-admin" target="_blank">Github</a>
                     <a href="https://jqhph.github.io/dcat-admin/docs.html" id="doc-link" target="_blank">{{ __('admin.documentation') }}</a>
                     <a href="https://jqhph.github.io/dcat-admin/docs/master/extensions.html" id="demo-link" target="_blank">{{ __('admin.extensions') }}</a>

+ 1 - 83
src/Controllers/PermissionController.php

@@ -41,13 +41,7 @@ class PermissionController extends AdminController
         return $content
             ->title($this->title())
             ->description(trans('admin.list'))
-            ->body(function (Row $row) {
-                if (request('_layout')) {
-                    $row->column(12, $this->grid());
-                } else {
-                    $row->column(12, $this->treeView());
-                }
-            });
+            ->body($this->treeView());
     }
 
     protected function simpleGrid()
@@ -77,12 +71,6 @@ class PermissionController extends AdminController
 
         $tree->disableCreateButton();
 
-        $tree->tools(function (Tree\Tools $tools) {
-            $label = trans('admin.table');
-            $url = url(request()->getPathInfo()).'?_layout=1';
-            $tools->add("<a class='btn btn-sm btn-white ' href='{$url}'>$label</a>");
-        });
-
         $tree->branch(function ($branch) {
             $payload = "<div class='pull-left' style='min-width:310px'><b>{$branch['name']}</b>&nbsp;&nbsp;[<span class='text-blue'>{$branch['slug']}</span>]";
 
@@ -129,76 +117,6 @@ class PermissionController extends AdminController
         return $tree;
     }
 
-    /**
-     * Make a grid builder.
-     *
-     * @return Grid
-     */
-    protected function grid()
-    {
-        $grid = new Grid(new Permission());
-
-        $grid->id('ID')->sortable();
-        $grid->name->tree();
-        $grid->order->orderable();
-        $grid->slug->label('primary');
-
-        $grid->http_path->display(function ($path) {
-            if (! $path) {
-                return;
-            }
-
-            $method = $this->http_method ?: ['ANY'];
-            $method = collect($method)->map(function ($name) {
-                return strtoupper($name);
-            })->map(function ($name) {
-                return "<span class='label bg-primary'>{$name}</span>";
-            })->implode('&nbsp;').'&nbsp;';
-
-            return collect($path)->filter()->map(function ($path) use ($method) {
-                if (Str::contains($path, ':')) {
-                    [$method, $path] = explode(':', $path);
-                    $method = collect(explode(',', $method))->map(function ($name) {
-                        return strtoupper($name);
-                    })->map(function ($name) {
-                        return "<span class='label bg-primary'>{$name}</span>";
-                    })->implode('&nbsp;').'&nbsp;';
-                }
-
-                if (! empty(config('admin.route.prefix'))) {
-                    $path = trim(admin_base_path($path), '/');
-                }
-
-                return "<div style='margin-bottom: 5px;'>$method<code>$path</code></div>";
-            })->implode('');
-        });
-
-        $grid->created_at;
-        $grid->updated_at->sortable();
-
-        $grid->disableEditButton();
-        $grid->showQuickEditButton();
-        $grid->enableDialogCreate();
-
-        $grid->tools(function (Grid\Tools $tools) {
-            $tools->batch(function (Grid\Tools\BatchActions $actions) {
-                $actions->disableDelete();
-            });
-
-            $label = trans('admin.default');
-            $url = url(request()->getPathInfo());
-            $tools->append("<a class='btn btn-white ' href='{$url}'>$label</a>");
-        });
-
-        $grid->filter(function (Grid\Filter $filter) {
-            $filter->like('slug');
-            $filter->like('name');
-            $filter->like('http_path');
-        });
-
-        return $grid;
-    }
-
     /**
      * Make a show builder.
      *

+ 3 - 3
src/Tree.php

@@ -367,14 +367,14 @@ class Tree implements Renderable
     tree.nestable($nestableOptions);
 
     $('.{$this->elementId}-save').click(function () {
-        var serialize = tree.nestable('serialize');
-        Dcat.NP.start();
+        var serialize = tree.nestable('serialize'), _this = $(this);
+        _this.buttonLoading();
         $.post('{$this->url}', {
             _token: Dcat.token,
             _order: JSON.stringify(serialize)
         },
         function () {
-            Dcat.NP.done();
+            _this.buttonLoading(false);
             Dcat.reload();
             Dcat.success('{$saveSucceeded}');
         });