-
- $("#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 = [
- {% 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;
- });