X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fslice-tab-users-view.html;h=18007ab153c6d4b70f7485616119eea71cccf356;hb=0efc21f12dd03d2cf3b9ed712e9ebf6c8fafd34e;hp=eef4161433301258a936e86da80d4cd56305d2de;hpb=a6018e408b2e24c7a8daeeaeae2ebb5b1446926f;p=myslice.git diff --git a/portal/templates/slice-tab-users-view.html b/portal/templates/slice-tab-users-view.html index eef41614..18007ab1 100644 --- a/portal/templates/slice-tab-users-view.html +++ b/portal/templates/slice-tab-users-view.html @@ -50,8 +50,24 @@ console.log(slice_users); } }); - }); // post rest/user - } + }); // post rest/use + + $('button#addusers').click(function() { + $.post("/update/slice/",{'filters':{'slice_hrn':'{{slice}}'},'params':{'users':slice_users}}, function(data) { + if(data.success){ + // TODO: highlight row after success + //$('tr[id="'+record_id+'"]').highlight(); + mysliceAlert('Success: slice updated','success', true); + }else{ + mysliceAlert('Rest Error for: '+data.error,'warning', true); + } + }); // post update slice + + // TODO: refresh table + //window.location="/portal/institution#slices"; + }); // button#addusers click + + } // get_users_in_slice $(document).ready(function() { // TODO: Add a filter based on the list of authorities @@ -71,15 +87,8 @@ $( "#auth_list" ).autocomplete({ source: list_authorities, minLength: 0, - change: function (event, ui) { - get_users_in_slice(this.value); - if(!ui.item){ - //http://api.jqueryui.com/autocomplete/#event-change - - //The item selected from the menu, if any. Otherwise the property is null - //so clear the item for force selection - jQuery("#auth_list").val(""); - alert("Please select an authority from the given list.") - } + select: function (event, ui) { + get_users_in_slice(ui.item.value); } //select: function( event, ui ) {console.log(jQuery(this))} }); @@ -87,21 +96,6 @@ get_users_in_slice("{{user_details.parent_authority}}"); - $('button#addusers').click(function() { - $.post("/update/slice/",{'filters':{'slice_hrn':'{{slice}}'},'params':{'users':slice_users}}, function(data) { - if(data.success){ - // TODO: highlight row after success - //$('tr[id="'+record_id+'"]').highlight(); - mysliceAlert('Success: slice updated','success', true); - }else{ - mysliceAlert('Rest Error for: '+data.error,'warning', true); - } - }); // post update slice - - // TODO: refresh table - //window.location="/portal/institution#slices"; - - }); // button#addusers click $('[title!=""]').qtip(); }); // document ready @@ -131,8 +125,6 @@ - {% if 'is_pi' in pi %} - {%endif%}