From: Loic Baron Date: Sat, 1 Mar 2014 16:34:05 +0000 (+0100) Subject: Institution: delete users and slices - this only works if the user has an authority... X-Git-Tag: myslice-1.1~255 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=688c0b20d06fe32e445ab5e585ac3b523b795edd;p=myslice.git Institution: delete users and slices - this only works if the user has an authority credential ! --- diff --git a/portal/static/js/institution.js b/portal/static/js/institution.js new file mode 100644 index 00000000..91907811 --- /dev/null +++ b/portal/static/js/institution.js @@ -0,0 +1,63 @@ +$(document).ready(function() { + $('a.home-tab').click(function() { + $('ul.nav-tabs li').removeClass('active'); + $(this).parent().addClass('active'); + $('div.home-panel').hide(); + $('div#'+$(this).data('panel')).show(); + }); + var url = window.location; + if(url.hash) { + // Fragment exists + tab = url.href.split("#")[1]; + tab_exists = $('div#'+tab).length; + if (tab_exists) { + $('ul.nav-tabs li').removeClass('active'); + $('li#'+tab+'-tab').addClass('active'); + $('div.home-panel').hide(); + $('div#'+tab).show(); + } + } + + /* TODO: factorize into functions */ + $('button#deleteusers').click(function() { + $('input:checkbox.user').each(function (index) { + if(this.checked){ + var record_id = this.id; + $.post("/delete/user/",{'filters':{'user_hrn':this.id}}, function(data) { + if(data.success){ + $('tr[id="'+record_id+'"]').fadeOut("slow"); + $('tr[id="'+record_id+'"]').remove(); + }else{ + alert("Rest Error for "+record_id+": "+data.error); + } + }); + + } + }); + }); + $('button#deleteslices').click(function() { + $('input:checkbox.slice').each(function (index) { + if(this.checked){ + var record_id = this.id; + $.post("/delete/slice/",{'filters':{'user_hrn':this.id}}, function(data) { + if(data.success){ + $('tr[id="'+record_id+'"]').fadeOut("slow"); + $('tr[id="'+record_id+'"]').remove(); + }else{ + alert("Rest Error for "+record_id+": "+data.error); + } + }); + + } + }); + }); + + $('button#createslice').click(function() { + window.location="/portal/slice_request/"; + }); + $('button#slicerequestbtn').click(function() { + /* + window.location="/portal/slice_request/"; + */ + }); +}); diff --git a/portal/templates/institution.html b/portal/templates/institution.html index d8fb1d77..1cef3738 100644 --- a/portal/templates/institution.html +++ b/portal/templates/institution.html @@ -1,5 +1,7 @@ {% extends "layout.html" %} - +{% block head %} + +{% endblock head %} {% block content %}

Institution: {{user_details.parent_authority}}

@@ -60,32 +62,6 @@