app/apps/plugins/visibility_post/assets/js/form.js in camaleon_cms-2.4.3.12 vs app/apps/plugins/visibility_post/assets/js/form.js in camaleon_cms-2.4.3.13

- old
+ new

@@ -1,26 +1,29 @@ jQuery(function($){ var panel = $("#panel-post-visibility"); var link_edit = panel.find(".edit-visibility").click(function(){ - panel.find(".panel-options").removeClass("hidden").show().find('input[name="post_private_groups[]"]:first').addClass('required data-error-place-parent'); + panel.find(".panel-options").removeClass("hidden").show(); link_edit.hide(); return false; }); panel.find(".lnk_hide").click(function(){ - panel.find(".panel-options").hide().find('input[name="post_private_groups[]"]:first').removeClass('required'); + panel.find(".panel-options").hide(); link_edit.show(); return false; }); panel.find("input[name='post[visibility]']").change(function(){ var label = $(this).closest("label"); panel.find(".visibility_label").html(label.text()); label.siblings("div").hide(); - label.next().show(); - }).click(function(){ - //var label = $(this).closest("label"); - //label.siblings("div").hide(); - //label.next().show(); + var rel_block = label.next().show(); + + if($(this).val() == 'private') rel_block.find('input.visibility_private_group_item:first').addClass('required data-error-place-parent'); + else panel.find('input.visibility_private_group_item:first').removeClass('required'); + + if($(this).val() == 'password') rel_block.find('input:text').addClass('required'); + else panel.find('input.password_field_value').removeClass('required'); + }).filter(":checked").trigger("change"); var cal_input = $("#form-post").find('#published_from'); cal_input.datetimepicker({format: 'YYYY-MM-DD HH:mm'}); }); \ No newline at end of file