Просмотр исходного кода

Merge branch 'github' into 2.0

jqh 4 лет назад
Родитель
Сommit
5aff66ac45

+ 4 - 4
resources/assets/dcat/extra/Upload/AddFile.js

@@ -81,21 +81,21 @@ export default class AddFile {
     // 显示错误信息
     showError ($li, code, file) {
         let _this = this,
-            __ = _this.uploader.lang.trans,
+            lang = _this.uploader.lang,
             text = '',
             $info = $('<p class="error"></p>');
 
         switch (code) {
             case 'exceed_size':
-                text = __('exceed_size');
+                text = lang.trans('exceed_size');
                 break;
 
             case 'interrupt':
-                text = __('interrupt');
+                text = lang.trans('interrupt');
                 break;
 
             default:
-                text = __('upload_failed');
+                text = lang.trans('upload_failed');
                 break;
         }
 

+ 1 - 1
resources/assets/dcat/js/extensions/Helpers.js

@@ -224,7 +224,7 @@ export default class Helpers {
                 title = title.substr(0, 50) + '...';
             }
 
-            win.layer.open({
+            layer.open({
                 type: 1,
                 shade: 0.2,
                 title: false,

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
resources/dist/dcat/extra/upload.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
resources/dist/dcat/extra/upload.js.map


+ 1 - 1
resources/views/filter/multipleselect.blade.php

@@ -3,7 +3,7 @@
         <span class="input-group-text bg-white text-capitalize"><b>{!! $label !!}</b></span>
     </div>
 
-    <select class="form-control {{ $class }}" name="{{$name}}[]" multiple style="width: 100%;">
+    <select class="form-control {{ $class }}" name="{{$name}}[]" multiple style="width: 100%;" data-value="{{implode(',',(array) $value)}}">
         @foreach($options as $select => $option)
             <option value="{{$select}}" {{ in_array((string)$select, (array) $value)  ?'selected':'' }}>{{$option}}</option>
         @endforeach

+ 3 - 3
src/Grid/ColumnSelector/CacheStore.php

@@ -15,16 +15,16 @@ class CacheStore extends SessionStore
 
     public function store(array $input)
     {
-        $this->driver->put($this->getVisibleColumnsKey(), $input, $this->ttl);
+        $this->driver->put($this->getKey(), $input, $this->ttl);
     }
 
     public function get()
     {
-        return $this->driver->get($this->getVisibleColumnsKey());
+        return $this->driver->get($this->getKey());
     }
 
     public function forget()
     {
-        $this->driver->forget($this->getVisibleColumnsKey());
+        $this->driver->forget($this->getKey());
     }
 }

+ 6 - 5
src/Grid/ColumnSelector/SessionStore.php

@@ -2,6 +2,7 @@
 
 namespace Dcat\Admin\Grid\ColumnSelector;
 
+use Dcat\Admin\Admin;
 use Dcat\Admin\Contracts\Grid\ColumnSelectorStore;
 use Dcat\Admin\Grid;
 
@@ -19,21 +20,21 @@ class SessionStore implements ColumnSelectorStore
 
     public function store(array $input)
     {
-        session()->put($this->getVisibleColumnsKey(), $input);
+        session()->put($this->getKey(), $input);
     }
 
     public function get()
     {
-        return session()->get($this->getVisibleColumnsKey());
+        return session()->get($this->getKey());
     }
 
     public function forget()
     {
-        session()->remove($this->getVisibleColumnsKey());
+        session()->remove($this->getKey());
     }
 
-    protected function getVisibleColumnsKey()
+    protected function getKey()
     {
-        return $this->grid->getName().'/'.request()->path();
+        return $this->grid->getName().'/'.request()->path().'/'.Admin::user()->getKey();
     }
 }

+ 7 - 2
src/Models/Administrator.php

@@ -32,14 +32,19 @@ class Administrator extends Model implements AuthenticatableContract
      * @param array $attributes
      */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.users_table'));
-
-        parent::__construct($attributes);
     }
 
     /**

+ 10 - 2
src/Models/Extension.php

@@ -12,14 +12,22 @@ class Extension extends Model
         'options' => 'json',
     ];
 
+    /**
+     * {@inheritDoc}
+     */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.extensions_table') ?: 'admin_extensions');
-
-        parent::__construct($attributes);
     }
 }

+ 10 - 2
src/Models/ExtensionHistory.php

@@ -8,14 +8,22 @@ class ExtensionHistory extends Model
 {
     protected $fillable = ['name', 'type', 'version', 'detail'];
 
+    /**
+     * {@inheritDoc}
+     */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.extension_histories_table') ?: 'admin_extension_histories');
-
-        parent::__construct($attributes);
     }
 }

+ 7 - 2
src/Models/Menu.php

@@ -44,14 +44,19 @@ class Menu extends Model implements Sortable
      * @param array $attributes
      */
     public function __construct(array $attributes = [])
+    {
+        parent::__construct($attributes);
+
+        $this->init();
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.menu_table'));
-
-        parent::__construct($attributes);
     }
 
     /**

+ 8 - 5
src/Models/Permission.php

@@ -33,19 +33,22 @@ class Permission extends Model implements Sortable
     protected $titleColumn = 'name';
 
     /**
-     * Create a new Eloquent model instance.
-     *
-     * @param array $attributes
+     * {@inheritDoc}
      */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.permissions_table'));
-
-        parent::__construct($attributes);
     }
 
     /**

+ 8 - 5
src/Models/Role.php

@@ -18,19 +18,22 @@ class Role extends Model
     protected $fillable = ['name', 'slug'];
 
     /**
-     * Create a new Eloquent model instance.
-     *
-     * @param array $attributes
+     * {@inheritDoc}
      */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.roles_table'));
-
-        parent::__construct($attributes);
     }
 
     /**

+ 10 - 2
src/Models/Setting.php

@@ -10,14 +10,22 @@ class Setting extends Model
     public $incrementing = false;
     protected $fillable = ['slug', 'value'];
 
+    /**
+     * {@inheritDoc}
+     */
     public function __construct(array $attributes = [])
+    {
+        $this->init();
+
+        parent::__construct($attributes);
+    }
+
+    protected function init()
     {
         $connection = config('admin.database.connection') ?: config('database.default');
 
         $this->setConnection($connection);
 
         $this->setTable(config('admin.database.settings_table') ?: 'admin_settings');
-
-        parent::__construct($attributes);
     }
 }

+ 2 - 2
src/Show.php

@@ -131,8 +131,8 @@ class Show implements Renderable
             $this->repository = Admin::repository($model);
         } elseif ($model instanceof Model) {
             if ($key = $model->getKey()) {
-                $this->key = $model->getKey();
-                $this->keyName = $model->getKeyName();
+                $this->setKey($key);
+                $this->setKeyName($model->getKeyName());
 
                 $this->model($model);
             } else {

Некоторые файлы не были показаны из-за большого количества измененных файлов