public $timestamps = true;
protected $_enableTrackNonDefaultValues = false;
+ protected $_enableTracEmptyValues = false;
protected static $_ownerAttribute = null;
return 'text';
}
- public function showPrimaryColumn(){
+ public function showPrimaryColumn()
+ {
return true;
}
if ($this->_enableTrackNonDefaultValues) {
$res[] = 'cubist_back::track-non-default-values';
}
+ if ($this->_enableTracEmptyValues) {
+ $res[] = 'cubist_back::track-empty-values';
+ }
return array_unique($res);
}
--- /dev/null
+@push('crud_fields_scripts')
+ <script type="text/javascript">
+ jQuery('document').ready(function ($) {
+ alert(':)');
+
+ $(document).on('change', 'select,input,textarea', function () {
+ $(this).addClass('live-change')
+ markEmptyChangedFields();
+ });
+
+ markEmptyChangedFields();
+ setTimeout(function () {
+ markEmptyChangedFields();
+ }, 1000);
+ });
+
+ function markEmptyChangedFields() {
+ $('select,input,textarea').find(':not([data-empty-tracking="0"])').each(function () {
+ var v = '';
+ $(this).find('[name="' + $(this).data('name') + '"]').each(function () {
+ v = $(this).val();
+ });
+
+ if (v != '') {
+ $(this).removeClass('empty');
+ } else {
+ $(this).addClass('empty');
+ }
+ });
+
+ $('.dropzone').each(function () {
+ if ($(this).find('.dz-preview').length > 0) {
+ $(this).closest('.form-group').addClass('empty');
+ } else {
+ $(this).closest('.form-group').removeClass('empty');
+ }
+ });
+
+ $('.bunchmultiple__items').each(function () {
+ if ($(this).find('.item:not(.sample)').length > 0) {
+ $(this).closest('.form-group').addClass('empty');
+ } else {
+ $(this).closest('.form-group').removeClass('empty');
+ }
+ });
+
+ $("#form_shortcuts nav a").each(function () {
+ var hasNonDefault = $($(this).attr('href')).closest('.card').find('.empty').length > 0;
+ if (hasNonDefault) {
+ $(this).addClass('empty');
+ } else {
+ $(this).removeClass('empty');
+ }
+ });
+ }
+
+ </script>
+@endpush
+
+@push('crud_fields_styles')
+ <style type="text/css">
+ .empty, .live-change {
+ position: relative;
+ }
+
+ .empty::after, .live-change:after {
+ content: '';
+
+ position: absolute;
+ display: block;
+ background-color: crimson;
+ width: 3px;
+
+ left: -5px;
+ top: -8px;
+ bottom: -8px;
+ }
+
+ .empty .restoreNonDefault {
+ visibility: visible;
+ }
+
+
+ .bunchfields .empty::after, .bunchfields .live-change::after {
+ display: none;
+ }
+
+ .bunchmultiple__wrapper .empty::after, .bunchmultiple__wrapper .live-change::after {
+ left: -20px;
+ }
+
+ #form_shortcuts .empty::after {
+ left: -30px;
+ top: -0px;
+ bottom: -0px;
+ }
+
+ .empty.live-change:after {
+ background-color: darkorange;
+ }
+
+ .live-change:after {
+ background-color: darkgreen;
+ }
+ </style>
+@endpush