From a228a3f58b5be134ebd4085294da28618c55268e Mon Sep 17 00:00:00 2001 From: Loic Baron Date: Mon, 26 Jan 2015 13:56:26 +0100 Subject: [PATCH] Slice request: select a project under an authority --- .../fed4fire/fed4fire_slicerequest_view.html | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/portal/templates/fed4fire/fed4fire_slicerequest_view.html b/portal/templates/fed4fire/fed4fire_slicerequest_view.html index 0d28ec19..82f12410 100644 --- a/portal/templates/fed4fire/fed4fire_slicerequest_view.html +++ b/portal/templates/fed4fire/fed4fire_slicerequest_view.html @@ -43,6 +43,12 @@ {% endif %}
+ Project: + +
+
@@ -66,6 +72,7 @@ jQuery(document).ready(function(){ $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) { var jsonData = JSON.parse(data); $(this).attr("value", jsonData[0]['parent_authority']); + draw_projects(jsonData[0]['parent_authority']); }); $("#authority_hrn").val("{{authority_name}}"); var availableTags = [ @@ -96,13 +103,28 @@ jQuery(document).ready(function(){ $( "#authority_hrn" ).autocomplete({ source: availableTags, minLength: 0, - select: function( event, ui ) {console.log(jQuery(this));} + select: function( event, ui ) { + draw_projects(jQuery('.ui-state-focus').html()); + }, }); - $("#submit_pi").click(function() { - localStorage.clear(); - }); }); + +function draw_projects(authority_hrn){ + $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS'+authority_hrn}}, function( data ) { + + var projects = []; + project_row = ""; + projects.push(project_row); + + $.each( data, function( key, val ) { + console.log(val); + project_row = ""; + projects.push(project_row); + }); + $("#projects").html(projects.join( "" )); + }); +} {% endblock %} -- 2.43.0