Skip to content

Commit ac3dc65

Browse files
committed
add search page to jinja2 template
see issue2550901
1 parent 0f7ed35 commit ac3dc65

File tree

3 files changed

+198
-2
lines changed

3 files changed

+198
-2
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ v2.7.2 is required to run newer releases of Roundup.
1313

1414
2018-??-?? ?.?.0
1515

16+
Features:
17+
18+
- issue2550901: add search page to jinja2 template (Christof Meerwald)
19+
1620
Fixed:
1721

1822
- issue2550811: work around Unicode encoding issues in jinja2 template

share/roundup/templates/jinja2/html/issue.index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{% include 'layout/permission.html' %}
1414

1515
{% if context.is_view_ok() %}
16-
{% if context.list() %}
16+
{% if request.batch() %}
1717
<table class='table'>
1818
<tr class='info'>
1919
{% if request.show.priority %}
@@ -44,7 +44,7 @@
4444
<td>{{ i18n.gettext('Assigned To')|u }}</td>
4545
{% endif %}
4646
</tr>
47-
{% for issue in context.list() %}
47+
{% for issue in request.batch() %}
4848
<tr>
4949
{% if request.show.priority %}
5050
<td>{{ issue.priority.plain()|u|e }}</td>
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{% extends 'layout/page.html' %}
2+
3+
{% set cols = request.columns or 'id activity title status assignedto'.split() %}
4+
{% set sort_on = request.sort and request.sort[0] or None %}
5+
{% set sort_desc = sort_on and sort_on[0] == '-' %}
6+
{% set sort_on = (sort_on and sort_on[1]) or 'activity' %}
7+
{% set group_on = request.group and request.group[0] or None %}
8+
{% set group_desc = group_on and group_on[0] == '-' %}
9+
{% set group_on = (group_on and group_on[1]) or 'status' %}
10+
11+
{% macro input(name, type='text') -%}
12+
<input type="{{ type }}" name="{{ name }}"
13+
value="{{ request.form.getvalue(name, '')|e }}" />
14+
{%- endmacro %}
15+
{% macro display_column(name) -%}
16+
<input type="checkbox" name="@columns"
17+
value="{{ name }}" {% if name in cols %}checked{% endif %} />
18+
{%- endmacro %}
19+
{% macro sort_column(name) -%}
20+
<input type="radio" name="@sort"
21+
value="{{ name }}" {% if name == sort_on %}checked{% endif %} />
22+
{%- endmacro %}
23+
{% macro group_column(name) -%}
24+
<input type="radio" name="@group"
25+
value="{{ name }}" {% if name == group_on %}checked{% endif %} />
26+
{%- endmacro %}
27+
{% macro option_value(option, id, name) -%}
28+
<option value="{{ id }}"
29+
{% if id == request.form.getvalue(option, '') %}selected{% endif %} >{{ name|u|e }}</option>
30+
{%- endmacro %}
31+
32+
{% block head_title %}
33+
Issue searching
34+
{% endblock %}
35+
36+
{% block page_header %}
37+
Issue searching
38+
{% endblock %}
39+
40+
{% block content %}
41+
42+
<form method="GET" name="itemSynopsis" action="{{ request.classname }}">
43+
44+
<table class="form">
45+
46+
<tr>
47+
<th class="header">&nbsp;</th>
48+
<th class="header">{{ i18n.gettext('Filter on')|u }}</th>
49+
<th class="header">{{ i18n.gettext('Display')|u }}</th>
50+
<th class="header">{{ i18n.gettext('Sort on')|u }}</th>
51+
<th class="header">{{ i18n.gettext('Group on')|u }}</th>
52+
</tr>
53+
54+
<tr>
55+
<th>{{ i18n.gettext('All text*:')|u }}</th>
56+
<td>{{ input('@search_text') }}</td>
57+
<td>&nbsp;</td>
58+
<td>&nbsp;</td>
59+
<td>&nbsp;</td>
60+
</tr>
61+
62+
<tr>
63+
<th>{{ i18n.gettext('Title:')|u }}</th>
64+
<td>{{ input('title') }}</td>
65+
<td>{{ display_column('title') }}</td>
66+
<td>{{ sort_column('title') }}</td>
67+
<td>&nbsp;</td>
68+
</tr>
69+
70+
<tr>
71+
<th>{{ i18n.gettext('Keyword:')|u }}</th>
72+
<td><select name="keyword" id="keyword">
73+
{{ option_value('keyword', '', 'don\'t care') }}
74+
{{ option_value('keyword', '-1', 'not selected') }}
75+
<option value="" disabled="disabled">------------</option>
76+
{% for keyword in db['keyword'].list() %}
77+
{{ option_value('keyword', keyword.id, keyword.name.plain()) }}
78+
{% endfor %}
79+
</select></td>
80+
<td>{{ display_column('id') }}</td>
81+
<td>{{ sort_column('id') }}</td>
82+
<td>&nbsp;</td>
83+
</tr>
84+
85+
<tr>
86+
<th>{{ i18n.gettext('ID:')|u }}</th>
87+
<td>{{ input('id') }}</td>
88+
<td>{{ display_column('id') }}</td>
89+
<td>{{ sort_column('id') }}</td>
90+
<td>&nbsp;</td>
91+
</tr>
92+
93+
<tr>
94+
<th>{{ i18n.gettext('Creation Date:')|u }}</th>
95+
<td>{{ input('creation') }}</td>
96+
<td>{{ display_column('creation') }}</td>
97+
<td>{{ sort_column('creation') }}</td>
98+
<td>{{ group_column('creation') }}</td>
99+
</tr>
100+
101+
<tr>
102+
<th>{{ i18n.gettext('Activity:')|u }}</th>
103+
<td>{{ input('activity') }}</td>
104+
<td>{{ display_column('activity') }}</td>
105+
<td>{{ sort_column('activity') }}</td>
106+
<td>&nbsp;</td>
107+
</tr>
108+
109+
<tr>
110+
<th>{{ i18n.gettext('Priority:')|u }}</th>
111+
<td><select name="priority" id="priority">
112+
{{ option_value('priority', '', 'don\'t care') }}
113+
{{ option_value('priority', '-1', 'not selected') }}
114+
<option value="" disabled="disabled">------------</option>
115+
{% for priority in db['priority'].list() %}
116+
{{ option_value('priority', priority.id, priority.name.plain()) }}
117+
{% endfor %}
118+
</select></td>
119+
<td>{{ display_column('priority') }}</td>
120+
<td>{{ sort_column('priority') }}</td>
121+
<td>{{ group_column('priority') }}</td>
122+
</tr>
123+
124+
<tr>
125+
<th>Status:</th>
126+
<td><select name="status" id="status">
127+
{{ option_value('status', '', 'don\'t care') }}
128+
{{ option_value('status', '-1', 'not selected') }}
129+
{{ option_value('status', status_notresolved, 'not resolved') }}
130+
<option value="" disabled="disabled">------------</option>
131+
{% for status in db['status'].list() %}
132+
{{ option_value('status', status.id, status.name.plain()) }}
133+
{% endfor %}
134+
</select></td>
135+
<td>{{ display_column('status') }}</td>
136+
<td>{{ sort_column('status') }}</td>
137+
<td>{{ group_column('status') }}</td>
138+
</tr>
139+
140+
<tr>
141+
<th>{{ i18n.gettext('Assigned to:')|u }}</th>
142+
<td>{{ input('submitter') }}</td>
143+
<td>{{ display_column('assignedto') }}</td>
144+
<td>{{ sort_column('assignedto') }}</td>
145+
<td>{{ group_column('assignedto') }}</td>
146+
</tr>
147+
148+
<tr>
149+
<th>{{ i18n.gettext('No Sort or group:')|u }}</th>
150+
<td>&nbsp;</td>
151+
<td>&nbsp;</td>
152+
<td><input type="radio" name="@sort" value=""></td>
153+
<td><input type="radio" name="@group" value=""></td>
154+
</tr>
155+
156+
<tr>
157+
<th>{{ i18n.gettext('Pagesize:')|u }}</th>
158+
<td><input name="@pagesize" size="3" value="{{ request.form.getfirst('@pagesize', '50') }}" /></td>
159+
</tr>
160+
161+
<tr>
162+
<th>{{ i18n.gettext('Start With:')|u }}</th>
163+
<td><input name="@startwith" size="3" value="{{ request.form.getfirst('@startwith', '0') }}" /></td>
164+
</tr>
165+
166+
<tr>
167+
<th>{{ i18n.gettext('Sort Descending:')|u }}</th>
168+
<td><input type="checkbox" name="@sortdir" {% if sort_desc %}checked{% endif %} /></td>
169+
</tr>
170+
171+
<tr>
172+
<th>{{ i18n.gettext('Group Descending:')|u }}</th>
173+
<td><input type="checkbox" name="@groupdir" {% if group_desc %}checked{% endif %} /></td>
174+
</tr>
175+
176+
<tr>
177+
<td>
178+
&nbsp;
179+
<input type="hidden" name="@action" value="search">
180+
</td>
181+
<td><input type="submit" value="Search" i18n:attributes="value"></td>
182+
</tr>
183+
184+
<tr><td>&nbsp;</td>
185+
<td colspan="4" class="help">
186+
{{ i18n.gettext('*: The "all text" field will look in message bodies and issue titles')|u }}
187+
</td>
188+
</tr>
189+
</table>
190+
</form>
191+
192+
{% endblock %}

0 commit comments

Comments
 (0)