diff --git a/modules/document/tpl/extra_keys.html b/modules/document/tpl/extra_keys.html index c3f9d56e7..3e2eba8f5 100644 --- a/modules/document/tpl/extra_keys.html +++ b/modules/document/tpl/extra_keys.html @@ -1,4 +1,5 @@ + @@ -49,7 +50,7 @@ -
+
@@ -57,14 +58,14 @@

{$lang->about_extra_vars_is_strict}

-
+

{$lang->about_extra_vars_default_value}

-
+
diff --git a/modules/document/tpl/js/document_extra_keys.js b/modules/document/tpl/js/document_extra_keys.js new file mode 100644 index 000000000..57a006239 --- /dev/null +++ b/modules/document/tpl/js/document_extra_keys.js @@ -0,0 +1,25 @@ +(function($) { + $(function() { + $('select#type').on('change', function() { + const selected_type = $(this).val(); + $(this).parents('form').find('.x_control-group').each(function() { + const visible_types = $(this).data('visibleTypes'); + if (visible_types) { + if (visible_types.split(',').indexOf(selected_type) >= 0) { + $(this).show(); + } else { + $(this).hide(); + } + } + const invisible_types = $(this).data('invisibleTypes'); + if (invisible_types) { + if (invisible_types.split(',').indexOf(selected_type) >= 0) { + $(this).hide(); + } else { + $(this).show(); + } + } + }); + }).triggerHandler('change'); + }); +})(jQuery);