Generic footer
[unfold.git] / portal / templates / smartfire / smartfire_slicerequest_view.html
1 {% extends "layout.html" %}
2 {% load i18n %}
3
4 {% block content %}
5         <div class="row">
6                 <div class="col-md-12">
7                          <div class="breadcrumbs">
8                                  Experiment &nbsp;>&nbsp; Request a new Slice
9                          </div>
10                 </div>
11         </div>
12
13         {% if errors %}
14         <div class="row">
15                 <div class="col-md-12">
16                 <ul class="error">
17                   {% for error in errors %}
18                   <li>{{ error }}</li>
19                   {% endfor %}
20                 </ul>
21                 </div>
22         </div>
23         {% endif %}
24         
25         <div class="row">
26                 <div class="col-md-8 el">
27                         <form role="form" method="post">
28                         {% csrf_token %}
29                           <div class="form-group" style="display:none">
30                             <input type="email" class="form-control" id="email" style="width:300px" value="{{ email }}" readonly="readonly">
31                           </div>
32                           <div class="form-group">
33                             <input type="text" class="form-control" name="slice_name" id="slice_name" style="width:300px" placeholder="Slice name" value="{{slice_name}}" 
34                                 title="Please enter a name for your slice"required="required">
35                           </div>
36                           <div class="form-group">
37                                 {%if 'is_pi'  in pi %}
38                                 <input type="text" class="form-control" id="authority_hrn" name="org_name" style="width:300px" placeholder="Organization" 
39                                 title="An authority responsible for vetting your slice" required="required">
40                                 {%else%}
41                             <input type="text" class="form-control" id="authority_hrn" name="org_name" placeholder="Organization" style="width:300px;" 
42                                 title="An authority responsible for vetting your slice" required="required" readonly>
43                                 {%endif%}
44                           </div>
45                           <div class="form-group">
46                             <input type="text" class="form-control" name="url" id="url" style="width:300px" placeholder="Experiment URL (if one exists)"
47                                 title="Please provide the url of your experiment if you have one." value="{{url}}">
48                           </div>
49                           <div class="form-group">
50                                 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment purpose" style="width:300px" 
51                                 title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
52                           </div>
53                           {%if 'is_pi'  in pi %}        
54                           <button type="submit" id=submit_pi class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
55                           {%else%}
56                           <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
57                           {%endif%}     
58                         </form>
59         
60                 </div>
61         </div>
62                 
63 <script>
64 jQuery(document).ready(function(){
65         
66         /*$("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
67                 var jsonData = JSON.parse(data);
68         $(this).attr("value", jsonData[0]['parent_authority']);
69     });*/
70         $("#authority_hrn").val("{{authority_name}}");
71         var availableTags = [
72     {% if authorities %}
73         {% for authority in authorities %}
74             {% if authority.name %}
75                 {value:"{{ authority.name }}",label:"{{authority.name}}"},
76                         // to show only full name
77            // {% else %}
78            //     {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
79             {% endif %}
80         {% endfor %}    
81     {% else %}
82         {value:"",label:"No authority found !!!"}
83     {% endif %}
84     ];
85         // sorting the list
86         availableTags.sort(function(a,b){
87                 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
88                 if (nameA < nameB) {
89                 return -1;
90                 }
91                 if (nameA > nameB) {
92                 return 1;
93                 }
94         return 0;
95         }); 
96     $( "#authority_hrn" ).autocomplete({
97       source: availableTags,
98       minLength: 0,
99       select: function( event, ui ) {console.log(jQuery(this));}
100     });
101
102         $("#submit_pi").click(function() {
103                 localStorage.clear();
104         });
105 });
106 </script>
107 {% endblock %}
108