list authorities, display name label only if available, else display authority_hrn
[unfold.git] / portal / templates / slicerequest_view.html
1 {% extends "layout-unfold1.html" %}
2 {% load i18n %}
3
4 {% block head %}
5 {{ wizard.form.media }}
6 {% endblock %}
7
8 {% block unfold_main %}
9
10 <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/onelab.css" />
11 <!-- xxx ideally only onelab.css but ... xxx -->
12 <link rel="stylesheet" type="text/css" href="{{STATIC_URL}}/css/registration.css" />
13
14 <div class="onelab-title well-lg">
15   <h2>Request a Slice</h2>
16 </div>
17
18 {% if errors %}
19 <ul>
20   {% for error in errors %}
21   <li>{{ error }}</li>
22   {% endfor %}
23 </ul>
24 {% endif %}
25
26 <div class='well'>
27   <form id="commentForm" class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
28   <fieldset>
29
30    <div class="form-group">
31      <label for="email" class="col-xs-2 control-label">Experimenter</label>
32      <div class="col-xs-4">
33         <label class="col-xs-2 control-label" style="height:34px;">{{ email }}</label>
34      </div>
35      <div class="col-xs-6"> <p class="form-hint">Experimenter requesting a Slice</p> </div>
36    </div>
37
38    <div class="form-group">
39      <label for="slice_name" class="col-xs-2 control-label">Slice Name</label>
40      <div class="col-xs-4">
41         <input type="text" name="slice_name" class="form-control" minlength="2" value="{{ slice_name }}" placeholder="Slice Name" required />
42      </div>
43      <div class="col-xs-6"> <p class="form-hint">The name of the slice you wish to create</p> </div>
44    </div>
45
46    <div class="form-group">
47      <label for="authority_hrn" class="col-xs-2 control-label">Authority</label>
48      <div class="col-xs-4">
49        <div class="ui-widget">
50            <input id="authority_hrn" name="authority_hrn" class="form-control" value="{{ authority_hrn }}" placeholder="Authority" required />
51        </div>
52     </div>
53      <div class="col-xs-6"><p class="form-hint">An authority responsible for vetting your slice</p></div>
54    </div>
55
56    <div class="form-group">
57      <label for="number_of_nodes" class="col-xs-2 control-label">Number of nodes</label>
58      <div class="col-xs-4">
59        <div class="ui-widget">
60            <input id="number_of_nodes" name="number_of_nodes" class="form-control" value="{{ number_of_nodes }}" />
61        </div>
62     </div>
63      <div class="col-xs-6"><p class="form-hint">Number of nodes you expect to request (informative)</p></div>
64    </div>
65
66    <div class="form-group">
67      <label for="purpose" class="col-xs-2 control-label">Experiment purpose</label>
68      <div class="col-xs-4">
69        <div class="ui-widget">
70            <textarea id="purpose" name="purpose" class="form-control" style="height:110px;" placeholder="Purpose" required>{{ purpose }}</textarea>
71        </div>
72     </div>
73      <div class="col-xs-6"><p class="form-hint">Purpose of your experiment (informative)</p></div>
74    </div>
75
76    <button class="submit btn btn-default col-xs-12" type="submit">Request Slice</button>
77   </fieldset>
78   </form>
79 </div>
80
81 <script>
82 jQuery(document).ready(function(){
83     var availableTags = [
84      {% if authorities %}
85          {% for authority in authorities %}
86              {% if authority.name %}
87                  {value:"{{ authority.authority_hrn }}",label:"{{authority.name}}"},
88              {% else %}
89                  {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
90              {% endif %}
91          {% endfor %}    
92      {% else %}
93          {value:"",label:"No authority found !!!"}
94      {% endif %}
95     ];
96     $( "#authority_hrn" ).autocomplete({
97       source: availableTags,
98       select: function( event, ui ) {console.log(jQuery(this))}
99     });
100 });
101 </script>
102 {% endblock %}
103