1 {% extends "layout.html" %}
7 <div class="col-md-12">
8 <ul class="nav nav-tabs nav-section">
9 <li class="active"><a href="#existing">Join existing Project</a></li>
10 <li><a href="#new">Create new Project</a></li>
18 <div class="col-md-12">
20 {% for error in errors %}
28 <div class="container tab-content">
30 <div class="tab-pane active" id="existing">
32 <div class="col-md-6">
33 <h3>Join an existing Project</h3>
35 <div class="col-md-6">
36 <h3>List of projects you are part of</h3>
40 <div class="col-md-6">
41 <form role="form" method="post">
43 <select id="projects"></select> <button type="submit" class="btn">Join</button>
46 <div class="col-md-6">
47 <table class="table project-list">
48 {% for pending in pending_projects %}
49 <tr><td>(PENDING) {{ pending.project_name }}</td><td>{{ pending.authority_hrn }}</td><td>{{ pending.created|date:"d/m/Y" }}</td></tr>
56 <div class="tab-pane" id="new">
58 <div class="col-md-12">
59 <h3>Create a new Project</h3>
65 <div class="col-md-12">
66 <form role="form" method="post" action="/portal/project_request">
68 <div class="form-group">
69 <input type="text" name="project_name" value="" placeholder="Name" required>
71 <div class="form-group">
72 <select id="org_name" name="authority_name" class="form-control" style="width:590px" value="{{ organization }}" required>
74 {% for authority in authorities %}
75 {% if authority.name %}
76 <option value="{{ authority.authority_hrn }}">{{authority.name}}</option>
78 <option value="{{ authority.authority_hrn }}">{{authority.authority_hrn}}</option>
86 <div class="form-group">
87 <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Description" style="width:300px" title="Purpose of your project (informative)" required="required"></textarea>
89 <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Send Request</button>
99 $(document).ready(function() {
100 var myprojects = localStorage.getItem('projects');
101 console.log(myprojects);
105 $('.project-list').html('<tr><td>no projetcs</td></tr>');
108 $('.nav-tabs a').click(function (e) {
112 $.post("/rest/myslice:authority/",{'fields':['authority_hrn','pi_users'],'filters':{'authority_hrn':'CONTAINS{{ authority_hrn }}' }}, function( data ) {
115 project_row = "<option value=''> - </option>";
116 projects.push(project_row);
118 $.each( data, function( key, val ) {
120 project_row = "<option value='"+val.authority_hrn+"'>"+val.authority_hrn+"</option>";
121 projects.push(project_row);
123 $("#projects").html(projects.join( "" ));
127 $("#authority_hrn").load("/rest/user/", {"fields" : ["parent_authority"], "filters": {"user_hrn": "{{ user_hrn }}"}}, function(data) {
128 var jsonData = JSON.parse(data);
129 $(this).attr("value", jsonData[0]['parent_authority']);
131 $("#authority_hrn").val("{{authority_name}}");
132 var availableTags = [
134 {% for authority in authorities %}
135 {% if authority.name %}
136 {value:"{{ authority.name }}",label:"{{authority.name}}"},
137 // to show only full name
139 {value:"{{ authority.authority_hrn }}",label:"{{authority.authority_hrn}}"},
143 {value:"",label:"No authority found !!!"}
147 availableTags.sort(function(a,b){
148 var nameA=a.value.toLowerCase(), nameB=b.value.toLowerCase();
157 $( "#authority_hrn" ).autocomplete({
158 source: availableTags,
160 select: function( event, ui ) {console.log(jQuery(this));}
163 $("#submit_pi").click(function() {
164 localStorage.clear();
166 // auto-complete the form
167 //jQuery("#org_name").combobox();