]> _ Git - cubist_cms-back.git/commitdiff
wip #5389 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Aug 2022 08:52:05 +0000 (10:52 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 12 Aug 2022 08:52:05 +0000 (10:52 +0200)
src/app/Magic/Fields/Field.php
src/resources/views/track-non-default-values.blade.php

index cc35ca351306e3ab6754775356b9cc4d2b31013b..6227586489b15b8352912b69fed7dfe27475d824 100644 (file)
@@ -149,7 +149,8 @@ class Field implements \ArrayAccess
             'translatable' => $this->_translatable, 'migrateTranslatable' => $this->_migrateTranslatable,
             'preview' => $this->_preview,
             'column_type' => $this->_columnType, 'column_move_after' => $this->_columnMoveAfter, 'column_format' => $this->_columnFormat, 'column_width' => 300, 'column_escape' => true,
-            'default' => $this->_default, 'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
+            'default' => $this->_default, 'non_default_tracking' => true,
+            'cast' => $this->_cast, 'column_view_namespace' => $this->_columnViewNamespace, 'searchLogic' => $this->_searchLogic,
             'allow_null' => true,
             'can' => $this->_can, 'can_write' => $this->_canWrite, 'auth' => $this->_auth,
             'database_type' => $this->_databaseType, 'database_unique' => $this->_databaseUnique, 'database_index' => $this->_databaseIndex, 'database_default' => $this->_databaseDefault, 'database_length' => $this->_databaseLength,
@@ -211,6 +212,7 @@ class Field implements \ArrayAccess
                 Arr::set($res, $e[1], $v);
             }
         }
+
         return $res;
     }
 
@@ -384,6 +386,10 @@ class Field implements \ArrayAccess
         if ($this->hasAttribute('when')) {
             $wrapperAttributes['data-when'] = json_encode($this->getAttribute('when'));
         }
+
+        if (!$this->getAttribute('non_default_tracking')) {
+            $wrapperAttributes['data-non-default-tracking'] = 0;
+        }
         $this->setAttribute('wrapperAttributes', $wrapperAttributes);
     }
 
index 4929f44a0c9eebeee70ebb3662d75bc69181302a..570107f6f825e1fb2661c0b731498a05803b9b45 100644 (file)
@@ -3,7 +3,7 @@
         jQuery('document').ready(function ($) {
 
             $(document).on('change', 'select,input,textarea', function () {
-                $(this).closest('[data-default]').addClass('live-change')
+                $(this).closest('[data-default]:not([data-non-default-tracking="0"])').addClass('live-change')
                 markChangedFields();
             });
 
@@ -30,7 +30,7 @@
         });
 
         function markChangedFields() {
-            $('[data-default]').each(function () {
+            $('[data-default]:not([data-non-default-tracking="0"])').each(function () {
                 var v = '';
                 $(this).find('[name="' + $(this).data('name') + '"]').each(function () {
                     if ($(this).is(':checkbox') && !$(this).prop('checked')) {