Child: [2267f3] (diff)

Download this file

bin.html    119 lines (113 with data), 5.4 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
{% extends g.theme.master %}
{% do g.register_forge_css('css/hilite.css') %}
{% do g.register_app_css('css/tracker.css') %}
{% block title %}{{c.project.name}} / {{app.config.options.mount_label}} / Saved Search Bins{% 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 Search Bins{% endblock %}
{% block content %}
{% if bins.__len__() %}
<form action="{{c.project.url()}}admin/{{app.config.options.mount_point}}/bins/update_bins" method="post" class="update_bins">
<table>
<thead>
<tr>
<th>Name</th>
<th>Terms</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody class="bin-list">
{% 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"><a href="#" class="btn search_help_modal"><b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b> Help</a></span>
{% if bin.error %}<br/><span style="color:red">{{bin.error}}</span>{% endif %}
</td>
<td style="width:40px;">
<a href="#" title="Delete" class="del_bin"><b data-icon="{{g.icons['delete'].char}}" class="ico {{g.icons['delete'].css}}"></b></a>
<a href="#" title="Edit" class="edit_bin"><b data-icon="{{g.icons['pencil'].char}}" class="ico {{g.icons['pencil'].css}}"></b></a>
<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-{{loop.index0}}.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"><a href="#" class="btn search_help_modal"><b data-icon="{{g.icons['help'].char}}" class="ico {{g.icons['help'].css}}"></b> Help</a></span>
{% 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 Bin</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>
</form>
{% else %}
No saved search bins have been created yet.
{% endif %}
{{c.search_help_modal.display()}}
{% 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 %}