Projects: added view and template (fed4fire)
[unfold.git] / portal / templates / fed4fire / fed4fire_projectrequest_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 Project or Join an existing one
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                                 <select id="org_name" name="org_name" class="form-control" style="width:590px" value="{{ organization }}" required> 
34                 {% if authorities %}
35                     {% for authority in authorities %}
36                         {% if authority.name %}
37                             <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
38                         {% else %}
39                             <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
40                         {% endif %}
41                     {% endfor %} 
42                 {% endif %}
43                 </select>
44                           </div>
45                           <div class="form-group">
46                 <input type="text">New Project</input>
47                           </div>
48                           <div class="form-group">
49                 <input type="text">Existing Project</input>
50                           </div>
51                           <div class="form-group">
52                                 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Project purpose" style="width:300px" 
53                                 title="Purpose of your project (informative)" required="required">{{ purpose }}</textarea>
54                           </div>
55                           {%if 'is_pi'  in pi %}        
56                           <button type="submit" id=submit_pi class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Create slice</button>
57                           {%else%}
58                           <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request slice</button>
59                           {%endif%}     
60                         </form>
61         
62                 </div>
63         </div>
64                 
65 <script>
66 jQuery(document).ready(function(){
67 /*
68         
69         $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
70                 var jsonData = JSON.parse(data);
71         $(this).attr("value", jsonData[0]['parent_authority']);
72     });
73         $("#authority_hrn").val("{{authority_name}}");
74         var availableTags = [
75     {% if authorities %}
76         {% for authority in authorities %}
77             {% if authority.name %}
78                 {value:"{{ authority.name }}",label:"{{authority.name}}"},
79                         // to show only full name
80             {% else %}
81                 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
82             {% endif %}
83         {% endfor %}    
84     {% else %}
85         {value:"",label:"No authority found !!!"}
86     {% endif %}
87     ];
88         // sorting the list
89         availableTags.sort(function(a,b){
90                 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
91                 if (nameA < nameB) {
92                 return -1;
93                 }
94                 if (nameA > nameB) {
95                 return 1;
96                 }
97         return 0;
98         }); 
99     $( "#authority_hrn" ).autocomplete({
100       source: availableTags,
101       minLength: 0,
102       select: function( event, ui ) {console.log(jQuery(this));}
103     });
104 */
105         $("#submit_pi").click(function() {
106                 localStorage.clear();
107         });
108         // auto-complete the form
109     jQuery("#org_name").combobox();
110
111 });
112 </script>
113 {% endblock %}
114