]> _ Git - cubist_cms-back.git/commitdiff
#2843
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Jun 2019 10:12:01 +0000 (12:12 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 28 Jun 2019 10:12:01 +0000 (12:12 +0200)
src/app/CubistCrudPanel.php
src/app/Magic/Fields/SelectFromArray.php
src/resources/views/fields/select2_from_array.blade.php

index e4d100167885be8ed442bb553eac2bd23b31611a..f31cdc4801379c29b169d4a9fedc4d142f008c9d 100644 (file)
@@ -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;
     }
 }
index bb1ed2b91a9abc88148dfe998087705105cbd651..e860daf07c1dd4e224abf1093df1d6e10f4d5aeb 100644 (file)
@@ -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';
index 8624cb7c9e092fa1e8bb6a2769772630e109db6d..4e65f418540ddf0a0de511cec921626c0fa26a14 100644 (file)
@@ -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')
         <!-- include select2 css-->
                 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"