summaryrefslogtreecommitdiffstats
path: root/app/views/principal_memberships/new.js.erb
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/principal_memberships/new.js.erb')
-rw-r--r--app/views/principal_memberships/new.js.erb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/views/principal_memberships/new.js.erb b/app/views/principal_memberships/new.js.erb
new file mode 100644
index 000000000..625eeaf68
--- /dev/null
+++ b/app/views/principal_memberships/new.js.erb
@@ -0,0 +1,13 @@
+$('#ajax-modal').html('<%= escape_javascript(render :partial => 'principal_memberships/new_modal') %>');
+showModal('ajax-modal', '700px');
+
+$('.projects-selection').on('click', 'input[type=checkbox]', function(e){
+ if (!$(this).is(':checked')) {
+ if ($(this).closest('li').find('ul input[type=checkbox]:not(:checked)').length > 0) {
+ $(this).closest('li').find('ul input[type=checkbox]:not(:checked)').attr('checked', 'checked');
+ e.preventDefault();
+ } else {
+ $(this).closest('li').find('ul input[type=checkbox]:checked').removeAttr('checked');
+ }
+ }
+});