1 {% extends "layout.html" %}
4 <script src="{{ STATIC_URL }}js/jquery-ui.js"></script>
5 <script src="{{ STATIC_URL }}js/jquery-ui-combobox.js"></script>
6 <link rel='stylesheet' type='text/css' href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
7 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/jquery.ui.combobox.css">
11 <div class="col-md-12">
12 <div class="breadcrumbs" style="line-height: 3;">
13 Experiment > Create or join a Project
18 <div class="col-md-12">
19 <ul class="nav nav-tabs nav-section">
20 <li class="active"><a href="#new">Create new Project</a></li>
21 <li><a href="#existing">Join existing Project</a></li>
29 <div class="col-md-12">
31 {% for error in errors %}
39 <div class="container tab-content">
41 <div class="tab-pane active" id="new">
44 <div class="col-sm-6 col-sm-offset-3">
45 <form role="form" method="post" action="/portal/project_request">
48 Please insert a name for your project under which you will be able to create slices <br />
49 <span class="sublabel">
50 The project name should only contain letters, numbers and the underscore "_" (10 max length)<br />
53 <div class="form-group">
54 <input type="text" name="project_name" value="" class="form-control" maxlength="10" style="width:100%;" title="The project name should not contain spaces but only letters, numbers and the underscore character" placeholder="Project name" required>
58 The authority under which your project will be managed <br />
59 <span class="sublabel">
60 Before you can access your project a manager of this authority should approve the request
63 <div class="form-group">
64 <select id="org_name" name="authority_name" class="form-control" style="width:100%" value="{{ organization }}" required>
66 {% for authority in authorities %}
67 {% if authority.name %}
68 <option value="{{ authority.authority_hrn }}" {% if authority.authority_hrn == authority_hrn %}selected{% endif %}>{{authority.name}}</option>
70 <option value="{{ authority.authority_hrn }}" {% if authority.authority_hrn == authority_hrn %}selected{% endif %}>{{authority.authority_hrn}}</option>
78 Please provide a description of the purpose for your project
80 <div class="form-group">
81 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Project description" style="width:100%" title="Purpose of your project (informative)" required="required"></textarea>
83 <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Send Request</button>
90 <div class="tab-pane" id="existing">
92 <div class="col-md-6">
93 <h3>Join an existing Project</h3>
95 <div class="col-md-6">
96 <h3>List of projects you are part of</h3>
100 <div class="col-md-6">
101 <form role="form" method="post" action="/portal/project_request">
103 <div id="project_loading" style="display:inline;"><img src="{{ STATIC_URL }}img/loading.gif" alt="Loading projects" /></div>
104 <select id="projects" name="project_name" style="display:none;"></select>
105 <div style="display:none;" id="projects_button">
106 <input type="submit" id="join" name="join" value="Join" class="btn"/>
110 <div class="col-md-6">
111 <table class="table project-list">
112 {% for pending in pending_projects %}
113 <tr><td>(PENDING) {{ pending.project_name }}</td><td>{{ pending.authority_hrn }}</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
115 {% for pending in pending_join_projects %}
116 <tr><td>(PENDING JOIN) {{ pending.project_name }}</td><td> </td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
126 $(document).ready(function() {
127 var myprojects = JSON.parse(localStorage.getItem('projects'));
129 $.each(myprojects, function (i, val){
130 $('.project-list').append('<tr><td>'+ val +'</td></tr>');
133 $('.project-list').html('<tr><td>no projects</td></tr>');
136 $('.nav-tabs a').click(function (e) {
140 $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS{{ root_authority_hrn }}' }}, function( data ) {
143 project_row = "<option value=''> - </option>";
144 projects.push(project_row);
146 $.each( data, function( key, val ) {
147 if(val.authority_hrn.split('.').length > 2){
148 if($.inArray(val.authority_hrn, myprojects)==-1){
149 project_row = "<option value='"+val.authority_hrn+"'>"+val.authority_hrn+"</option>";
150 projects.push(project_row);
154 $("#projects").show();
155 $("#projects_button").css('margin-left', '50px');
156 $("#projects_button").css('display', 'inline-block');
157 $("#project_loading").hide();
158 $("#projects").html(projects.join( "" ));
159 $("#projects").combobox();
160 var $s = jQuery("#projects").next().attr('id','listProjects');
161 jQuery('#listProjects').bind("click",function(){
162 // show all items click
163 this.childNodes[1].click();
169 $("#authority_hrn").load("/rest/myslice:user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
170 var jsonData = JSON.parse(data);
171 $(this).attr("value", jsonData[0]['parent_authority']);
173 $("#authority_hrn").val("{{authority_name}}");
174 var availableTags = [
176 {% for authority in authorities %}
177 {% if authority.name %}
178 {value:"{{ authority.name }}",label:"{{authority.name}}"},
179 // to show only full name
181 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
185 {value:"",label:"No authority found !!!"}
189 availableTags.sort(function(a,b){
190 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
199 $( "#authority_hrn" ).autocomplete({
200 source: availableTags,
202 select: function( event, ui ) {console.log(jQuery(this));}
205 $("#submit_pi").click(function() {
206 localStorage.clear();
208 // auto-complete the form
209 jQuery("#org_name").combobox();
211 $('input[name=project_name]').keyup(function(){
212 this.value = this.value.toLowerCase();