X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Ffed4fire%2Ffed4fire_slicerequest_view.html;h=063a9f830136f1b6381a7f0e887a36af1c333719;hb=958afd7b86e20e1529c2f7cc4662b47205945c40;hp=0d28ec19f50961b6e85657ed096a43f5e7471f21;hpb=67dd0c2e73f832813a1b51390264191a49a643f0;p=unfold.git
diff --git a/portal/templates/fed4fire/fed4fire_slicerequest_view.html b/portal/templates/fed4fire/fed4fire_slicerequest_view.html
index 0d28ec19..063a9f83 100644
--- a/portal/templates/fed4fire/fed4fire_slicerequest_view.html
+++ b/portal/templates/fed4fire/fed4fire_slicerequest_view.html
@@ -34,13 +34,8 @@
title="Please enter a name for your slice"required="required">
- {% if pi %}
-
- {% else %}
-
- {% endif %}
+
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']);
- });
- $("#authority_hrn").val("{{authority_name}}");
- var availableTags = [
- {% if authorities %}
- {% for authority in authorities %}
- {% if authority.name %}
- {value:"{{ authority.name }}",label:"{{authority.name}}"},
- // to show only full name
- {% else %}
- {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
- {% endif %}
- {% endfor %}
- {% else %}
- {value:"",label:"No authority found !!!"}
- {% endif %}
- ];
- // sorting the list
- availableTags.sort(function(a,b){
- var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
- if (nameA < nameB) {
- return -1;
- }
- if (nameA > nameB) {
- return 1;
- }
- return 0;
- });
+ var myprojects = JSON.parse(localStorage.getItem('projects'));
$( "#authority_hrn" ).autocomplete({
- source: availableTags,
- minLength: 0,
- select: function( event, ui ) {console.log(jQuery(this));}
+ source: myprojects,
+ change: function (event, ui) {
+ 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
+ $("#authority_hrn").val("");
+ }
+ }
});
-
- $("#submit_pi").click(function() {
- localStorage.clear();
- });
});
+
+/*function draw_projects(authority_hrn){
+
+ var projects = [];
+ project_row = "";
+ projects.push(project_row);
+
+ if(authority_hrn.length > 0){
+ // Not for root authority
+ if(authority_hrn.split('.').length > 1){
+ $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS'+authority_hrn}}, function( data ) {
+
+ $.each( data, function( key, val ) {
+ project_row = "";
+ projects.push(project_row);
+ });
+ $("#project").html(projects.join( "" ));
+ });
+ }else{
+ $("#project").html(projects.join( "" ));
+ }
+ }else{
+ my_projects = JSON.parse(localStorage.getItem('projects'));
+ $.each( my_projects, function( i, val ) {
+ project_row = "";
+ projects.push(project_row);
+ });
+ $("#project").html(projects.join( "" ));
+ }
+ $("#project").show();
+ $("#project_loading").hide();
+}*/
{% endblock %}