X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Ftemplates%2Fonelab%2Fonelab_slicerequest_view.html;h=5d0cf56e86f4ed1e7dcc2ea2f6599c0b11ade1a2;hb=4ffe03690aff813d103a34ed084ae79c4a9dee72;hp=ef0ca28f7d84f543f30af48e7c03f39181fb9393;hpb=b932fc56d413781f414819c67ade7e69b707d1fb;p=myslice.git
diff --git a/portal/templates/onelab/onelab_slicerequest_view.html b/portal/templates/onelab/onelab_slicerequest_view.html
index ef0ca28f..5d0cf56e 100644
--- a/portal/templates/onelab/onelab_slicerequest_view.html
+++ b/portal/templates/onelab/onelab_slicerequest_view.html
@@ -35,11 +35,11 @@
{%if 'is_pi' in pi %}
-
{%else%}
-
+
{%endif%}
@@ -61,21 +61,34 @@ 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']);
+ // getting the authority from the view not rest
+ $(this).attr("value", "{{authority_name}}");
});
- var availableTags = [
- {% if authorities %}
- {% for authority in authorities %}
- {% if authority.name %}
- {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
- {% else %}
- {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
- {% endif %}
- {% endfor %}
- {% else %}
- {value:"",label:"No authority found !!!"}
- {% endif %}
+ 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;
+ });
$( "#authority_hrn" ).autocomplete({
source: availableTags,
minLength: 0,