[e455b7]: / Allura / allura / templates / site_admin_new_projects.html  Maximize  Restore  History

Download this file

187 lines (178 with data), 7.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% set page = "new_projects" %}
{% set hide_left_bar = True %}
{% extends 'allura:templates/site_admin.html' %}
{% block title %}New Projects{% endblock %}
{% block header %}New Projects{% endblock %}
{% macro _paging() %}
<div class="paging">
<a class="newer" title="Newer" href="{{ newer_url }}">&lt;</a>&nbsp;&hellip;&nbsp;
<a class="newer" title="Older" href="{{ older_url }}">&gt;</a>
</div>
{% endmacro %}
{% block content %}
<div class="grid-24">
<form method="GET">
<div class="grid-13">
<label for="start-dt">From: </label><input type="text" name="start-dt" id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
<label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt" value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
</div>
<div class="grid-3"><input type="submit" value="Filter"></div>
</form>
</div>
{{ _paging() }}
<div style="clear:both;"></div>
<table id="new_projects">
<thead>
<tr>
<th class="narrow"></th>
<th>Created</th>
<th>Shortname</th>
<th>Name</th>
<th>Short description</th>
<th>Summary</th>
<th>Homepage</th>
<th>Admins</th>
</tr>
</thead>
{% for p in projects %}
<tr>
<td class="narrow">
<input type="checkbox" class="js-select-project" data-shortname="{{ p.shortname }}" data-url="{{ p.url() }}" />
</td>
<td class="narrow">
<small>{{ p._id.generation_time.strftime('%Y-%m-%d %H:%M:%S') }}</small>
</td>
<td><small>{{ p.shortname }}</small></td>
<td><small><a href="{{ p.url() }}">{{ p.name }}</a></small></td>
<td><small>{{ p.short_description|truncate(100) }}</small></td>
<td><small>{{ p.summary }}</small></td>
<td><small>{{ p.external_homepage|urlize(22) }}</small></td>
<td>{% for a in p.admins() %}<small><a href="/nf/admin/user/{{ a.username }}">{{ a.username }}</a></small> {% endfor %}</td>
</tr>
<tr class="tablesorter-childRow">
<td colspan="8" class="child-row">
{% set note = p.get_tool_data('notes', 'note') %}
<a class="add-note" title="click to add a not for this project" data-project="{{ p.shortname }}" href="#"><i class="fa fa-edit"></i> {% if note %}edit note{% else %}add note{%endif %}</a>
<br>
{% if note %}
<strong>Notes:</strong> <span class="project-note">{{ note }}</span>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
{{ _paging() }}
<div id="selected-projects"></div>
<div id="delete-projects-url" class="grid-19"></div>
{% endblock %}
{% block extra_css %}
<style type="text/css">
.paging {
float: right;
margin: 1em;
}
.pad table {
width: 915px;
}
td {
max-width: 120px;
}
th.tablesorter-header {
background-image: url("{{g.forge_static('images/bg.gif')}}");
cursor: pointer;
font-weight: bold;
background-repeat: no-repeat;
background-position: center left;
padding-left: 20px;
}
th.tablesorter-headerAsc{
background-image: url("{{g.forge_static('images/asc.gif')}}");
background-repeat: no-repeat;
background-position: 100% 50%;
background-color: #6bb3fd;
}
th.tablesorter-headerDesc{
background-image: url("{{g.forge_static('images/desc.gif')}}");
background-repeat: no-repeat;
background-position: 100% 50%;
background-color: #6bb3fd;
}
td.child-row{ text-align:center}
.note-buttons{
display: flex;
justify-content: center;
}
</style>
{% endblock %}
{% block extra_js %}
<script type="text/javascript" src="{{g.forge_static('js/site_admin_new_projects.js')}}"></script>
<script type="text/javascript" src="{{g.forge_static('js/jquery.tablesorter.js')}}"></script>
<script type="text/JavaScript">$(document).ready(function() {
$(function(){
$('#new_projects').tablesorter({
usNumberFormat : false,
sortReset : false,
sortRestart : false
});
});
$('.add-note').each(function(el){
var el = $(this);
el.on('click', function(evt){
evt.preventDefault();
var project_shortname = el.data('project');
var form_exists = el.closest('tr').find('td:first').find('form');
var notes = el.closest('tr').find('td:first').find('.project-note')
if (form_exists.length > 0) {
return;
}
var form = $('<form></form>')
var textarea = $('<textarea class="note" rows="5" cols="100"></textarea>');
var submit_btn = $('<button type="submit" class="button blue right">Submit</button>');
var cancel_btn = $('<button class="" >Cancel</button>');
var div = $('<div class="note-buttons"></div>')
if (notes){
textarea.val(notes.text());
}
form.append(textarea)
div.append(submit_btn);
div.append(cancel_btn);
form.append(div);
el.closest('tr').find('td:first').append(form)
form.on('submit', function(evt){
evt.preventDefault();
var url = "{{ request.path.replace('new_projects', 'save_project_note')}}";
var data = {'_csrf_token': $.cookie('_csrf_token'), 'note': textarea.val(), 'shortname': project_shortname}
$.post(url,data).done(function(response){
flash(response.message, 'success');
form.remove();
var td = el.closest('tr').find('td:first');
td.html('<p><strong>Notes:</strong>' + textarea.val() + '</p>');
el.remove();
}).fail(function (response){
flash(response.message, 'error');
})
})
cancel_btn.on('click', function(evt){
evt.preventDefault();
form.remove();
})
})
})
} );</script>
{% endblock %}