Skip to content

Instantly share code, notes, and snippets.

@gmgent
Created March 8, 2011 18:58
Show Gist options
  • Save gmgent/860775 to your computer and use it in GitHub Desktop.
Save gmgent/860775 to your computer and use it in GitHub Desktop.
ApprovalStatuses = {
deleteApprovalStatus: function() {
if(confirm("Are you sure you want to delete this approval status?")) {
if($(this).parent("form").find("input[name='drug_record_count']").val() > 0) {
$("#move_drug_records_form").attr("action", $(this).parent("form").attr("action"));
var approvalStatusId = $(this).parent("form").find("input[name='approval_status_id']").val();
$("#target_approval_status_id").customSelect.hideOption(approvalStatusId);
Thickbox.show({inlineId: "move_drug_records", modal: true, height: 200, width: 380});
} else {
$(this).parent("form").submit();
}
}
}
};
$.fn.exclusiveCheckboxes = function() {
var checkbox1 = this[0];
var checkbox2 = this[1];
$(checkbox1).change(function() {
if($(this).is(":checked")) {
$(checkbox2).attr("checked", false);
}
});
$(checkbox2).change(function() {
if($(this).is(":checked")) {
$(checkbox1).attr("checked", false);
}
});
};
$(document).ready(function() {
$(".delete_approval_status").click(ApprovalStatuses.deleteApprovalStatus);
$("a.hide_thickbox").click(Thickbox.hide);
$("#approval_status_voteable, #approval_status_notify_approval_committee").exclusiveCheckboxes();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment