app/assets/javascripts/custom/people.js in artfully_ose-1.2.0 vs app/assets/javascripts/custom/people.js in artfully_ose-1.3.0.pre1

- old
+ new

@@ -5,14 +5,36 @@ $("#communication-preference input[type=checkbox]").on("click", function(event) { $("#communication-preference input[type=submit]").removeClass("hidden"); }); $("#subscription-listing input[type=checkbox]").on("click", function(event) { - $("#subscription-listing input[type=submit]").removeClass("hidden"); + if (!$(this).prop("checked") || $(this).data("group")) { + $("#subscription-listing input[type=submit]").removeClass("hidden"); + } }); - $("#person_do_not_call").on("click", function(event) { + $("#subscription-listing .show-all").on("click", function(event) { + event.preventDefault(); + + $target = $(event.target); + $list = $target.parents(".list"); + + $inactive = $list.find(".inactive"); + + if ($inactive.is(":visible")) { + $(event.target).html("&#9656;"); + $list.find(".grouping .name").hide(); + $inactive.hide(); + } else { + $(event.target).html("&#9662;"); + $list.find(".grouping .name").removeClass("hidden"); + $list.find(".grouping .name").show(); + $inactive.show(); + }; + }); + + $("#individual_do_not_call").on("click", function(event) { $lists = $(".mail-chimp-list"); if ($(this).attr("checked") != "checked") { $lists.attr("disabled", false); } else { $lists.attr("checked", false); @@ -30,9 +52,16 @@ event.preventDefault(); $("#subscribe-modal").modal(); $("#subscribe-modal .btn-primary").on("click", function(e) { $(event.target).attr("checked", "checked"); $("#subscribe-modal").modal('hide'); + $form = $(event.target).parents("form"); + optin = $("<input type='checkbox' name='single_optin'>"); + optin.val($("input[name=single_optin]:checked").val()); + optin.prop("checked", true); + optin.hide(); + $form.append(optin); + $(event.target).parents("form").submit(); }); }); var is_star = function(htmlElement) { return (htmlElement === "\u272D");