From c3ea0056ecc3705f7bc0da6acd2bb9ab5442552f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jordan=20Aug=C3=A9?= Date: Tue, 4 Mar 2014 18:54:20 +0100 Subject: [PATCH] Institution: Renew Slice working, refresh missing --- portal/static/js/institution.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/portal/static/js/institution.js b/portal/static/js/institution.js index 17858fed..dc448702 100644 --- a/portal/static/js/institution.js +++ b/portal/static/js/institution.js @@ -51,6 +51,29 @@ $(document).ready(function() { } }); }); + $('button#renewslices').click(function() { + var now = new Date(); + /* In Javascript getMonth() gives month[0] = january, month[1] = february, and so on... */ + var month = now.getMonth()+2; + var one_month_later = now.getFullYear()+"-"+month+"-"+now.getDate()+" "+now.getHours()+":"+now.getMinutes()+":"+now.getSeconds(); + console.log(one_month_later); + $('input:checkbox.slice').each(function (index) { + if(this.checked){ + var record_id = this.id; + $.post("/update/slice/",{'filters':{'slice_hrn':this.id},'params':{'expires':one_month_later}}, function(data) { + if(data.success){ + // TODO: highlight row after success + //$('tr[id="'+record_id+'"]').highlight(); + }else{ + alert("Rest Error for "+record_id+": "+data.error); + } + }); + + } + }); + // TODO: refresh table + //window.location="/portal/institution#slices"; + }); $('button#createslice').click(function() { window.location="/portal/slice_request/"; -- 2.43.0