[a158f3]: / ForgeTracker / forgetracker / templates / tracker / bin.html  Maximize  Restore  History

Download this file

148 lines (140 with data), 6.3 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
{#-
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.
-#}
{% extends g.theme.master %}
{% do g.register_app_css('css/tracker.css') %}
{% block title %}{{c.project.name}} / {{app.config.options.mount_label}} / Saved Searches{% endblock %}
{% block head %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="feed.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom" href="feed.atom"/>
{% endblock %}
{% block header %}Saved Searches{% endblock %}
{% block content %}
<form action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/bins/update_bins" method="post"
class="update_bins" id="saved-search-form">
<table>
<thead>
<tr>
<th>Name</th>
<th>Terms</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody class="bin-list">
{% if not bins %}
<tr><td colspan="3">No saved searches have been created yet.</td></tr>
{% endif %}
{% for bin in bins %}
<tr{% if loop.index0 % 2 == 0 %} class="even"{% endif %}>
<td class="view" {% if bin.error %}style="display:none"{% endif %}><a href="{{bin.url()}}">{{bin.summary}}</a></td>
<td class="view" {% if bin.error %}style="display:none"{% endif %}>{{bin.terms}}</td>
<td class="edit" style="{% if not bin.error %}display:none{% else %}vertical-align:top{% endif %}"><input type="text" name="bins-{{loop.index0}}.summary" value="{{bin.summary}}"></td>
<td class="edit" {% if not bin.error %}style="display:none"{% endif %}>
<input class="grid-8" type="text" name="bins-{{loop.index0}}.terms" value="{{bin.terms}}">
<span class="grid-3">
{{ g.icons['help'].render(
show_title=True,
target='_blank',
href=tg.url(app.url + 'search_help/'),
rel='nofollow',
extra_css='btn search_help_modal') }}
{% if bin.error %}<br/><span style="color:red">{{bin.error}}</span>{% endif %}
</td>
<td style="width:40px;">
{{ g.icons['delete'].render(extra_css='del_bin') }}
{{ g.icons['edit'].render(extra_css='edit_bin') }}
<input type="hidden" name="bins-{{loop.index0}}.id" value="{{bin._id | string}}">
<input type="hidden" name="bins-{{loop.index0}}.delete" value="False" class="delete_flag">
</td>
</tr>
{% endfor %}
{% set num_bins = bins.__len__() %}
<tr class="new_bin" {% if not (new_bin and new_bin.error) %}style="display:none"{% endif %}>
<td {% if new_bin and new_bin.error %}style="vertical-align:top"{% endif %}>
<input type="hidden" name="bins-{{num_bins}}.id">
<input type="hidden" name="bins-{{num_bins}}.delete" value="False" class="delete_flag">
<input type="text" name="bins-{{num_bins}}.summary" placeholder="Summary" {% if new_bin %}value="{{new_bin.summary}}"{% endif %}>
</td>
<td>
<input class="grid-8" type="text" name="bins-{{num_bins}}.terms" placeholder="Terms" {% if new_bin %}value="{{new_bin.terms}}"{% endif %}>
<span class="grid-3">
{{ g.icons['help'].render(
show_title=True,
target='_blank',
href=tg.url(app.url + 'search_help/'),
rel='nofollow',
extra_css='btn search_help_modal') }}
{% if new_bin and new_bin.error %}<br/><span class="err" style="color:red">{{new_bin.error}}</span>{% endif %}
</td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<div class="grid-16"><a href="#" class="btn add_bin grid-3" {% if errors %}style="display:none"{% endif %}>Add Search</a></div>
<div class="grid-16 save_controls" {% if not errors %}style="display:none"{% endif %}>
<input type="submit" value="Save">
{% if errors %}
<a href="." class="btn link">Cancel</a>
{% else %}
<a href="#" class="btn link cancel_edit">Cancel</a>
{% endif %}
</div>
{{lib.csrf_token()}}
</form>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(document).ready(function(){
$('form.update_bins').each(function(){
var $form = $(this);
var $new_row = $('tr.new_bin', $form);
var $add_button = $('a.add_bin', $form);
var $save_controls = $('div.save_controls', $form);
$('a.add_bin').click(function(){
$save_controls.show();
$add_button.hide();
$new_row.show();
return false;
});
$('a.edit_bin').click(function(){
var $row = $(this).closest('tr');
$('td.view', $row).hide();
$('td.edit', $row).show();
$save_controls.show();
$add_button.hide();
$(this).css({opacity: 0.5});
return false;
});
$('a.del_bin').click(function(){
var $row = $(this).closest('tr');
$('input.delete_flag', $row).val('True');
$form.submit();
});
$('a.cancel_edit').click(function(){
$('td.view', $form).show();
$('td.edit', $form).hide();
$save_controls.hide();
$add_button.show();
$new_row.hide();
$('input', $new_row).val('');
$('span.err', $new_row).html('');
$('a.edit_bin').css({opacity: 1});
return false;
});
});
});
</script>
{% endblock %}