From: Vincent Vanwaelscappel Date: Fri, 28 Jun 2019 10:12:01 +0000 (+0200) Subject: #2843 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6c600fcf71087f124bcb6d2e12be0cc0a8df7aa9;p=cubist_cms-back.git #2843 --- diff --git a/src/app/CubistCrudPanel.php b/src/app/CubistCrudPanel.php index e4d1001..f31cdc4 100644 --- a/src/app/CubistCrudPanel.php +++ b/src/app/CubistCrudPanel.php @@ -43,10 +43,11 @@ class CubistCrudPanel extends CrudPanel public function checkIfFieldIsFirstOfItsType($field) { - if (isset($this->_seenFieldTypes[$field['type']])) { + $type = $field['type']; + if (isset($this->_seenFieldTypes[$type])) { return false; } - $this->_seenFieldTypes[$field['type']] = true; + $this->_seenFieldTypes[$type] = true; return true; } } diff --git a/src/app/Magic/Fields/SelectFromArray.php b/src/app/Magic/Fields/SelectFromArray.php index bb1ed2b..e860daf 100644 --- a/src/app/Magic/Fields/SelectFromArray.php +++ b/src/app/Magic/Fields/SelectFromArray.php @@ -9,6 +9,7 @@ use Cubist\Backpack\CubistBackpackServiceProvider; class SelectFromArray extends Field { protected $_adminType = 'select2_from_array'; + protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields'; protected $_columnType = 'select_from_array'; protected $_columnViewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::columns'; protected $_databaseType = 'string'; diff --git a/src/resources/views/fields/select2_from_array.blade.php b/src/resources/views/fields/select2_from_array.blade.php index 8624cb7..4e65f41 100644 --- a/src/resources/views/fields/select2_from_array.blade.php +++ b/src/resources/views/fields/select2_from_array.blade.php @@ -51,7 +51,6 @@ {{-- Extra CSS and JS for this particular field --}} {{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}} @if ($crud->checkIfFieldIsFirstOfItsType($field)) - {{-- FIELD CSS - will be loaded in the after_styles section --}} @push('crud_fields_styles') @@ -74,9 +73,12 @@ initUntriggeredSelectFromArray(); function initUntriggeredSelectFromArray() { - console.log(':)))'); // trigger select2 for each untriggered select2 box $('.select2_from_array').each(function (i, obj) { + if($(obj).closest('.item.sample').length>0){ + return; + } + if (!$(obj).hasClass("select2-hidden-accessible")) { $(obj).select2({ theme: "bootstrap"