Skip to content

Commit b76e775

Browse files
committed
issue2551075 Update jinja template to bootstrap 4.
Updated to 4.1.3 (current boostrap version 4.4.1). The pull request has been around for a while. (Patch: Paul Spooner; templates merged by Christof Meerwald; other merged by John Rouillard)
1 parent 6d5a704 commit b76e775

File tree

15 files changed

+219
-205
lines changed

15 files changed

+219
-205
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Features:
3636
admin to control caching for css, js and other static files. See
3737
customizing.html. The use is documented in the section describing
3838
how to use interfaces.py.
39+
- issue2551075 Update jinja template to bootstrap 4. Updated to 4.1.3
40+
(current 4.4.1). The pull request has been around for a
41+
while. (Patch: Paul Spooner; templates merged by Christof Meerwald;
42+
other merged by John Rouillard)
3943

4044
Fixed:
4145

doc/upgrading.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,14 @@ Responsive template changes
253253
---------------------------
254254

255255
There have been some changes to the responsive template. You can
256-
diff/merge these changes into your responsive template.
256+
diff/merge these changes into your responsive template based tracker.
257257

258+
Jinja template changes
259+
----------------------
260+
261+
The jinja template has been upgraded to use bootstrap 4.1.3 (from
262+
2.2.2). You can diff/merge changes into your jinja template based
263+
tracker.
258264

259265
Migrating from 1.5.1 to 1.6.0
260266
=============================

roundup/cgi/templating.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,17 +795,20 @@ def classhelp(self, properties=None, label=''"(list)", width='500',
795795
(help_url, onclick, self.cgi_escape_attrs(**html_kwargs),
796796
self._(label))
797797

798-
def submit(self, label=''"Submit New Entry", action="new"):
798+
def submit(self, label=''"Submit New Entry", action="new", html_kwargs={}):
799799
""" Generate a submit button (and action hidden element)
800800
801+
"html_kwargs" specified additional html args for the
802+
generated html <select>
803+
801804
Generate nothing if we're not editable.
802805
"""
803806
if not self.is_edit_ok():
804807
return ''
805808

806809
return \
807810
self.input(type="submit", name="submit_button",
808-
value=self._(label)) + \
811+
value=self._(label), **html_kwargs) + \
809812
'\n' + \
810813
self.input(type="hidden", name="@csrf",
811814
value=anti_csrf_nonce(self._client)) + \
@@ -940,14 +943,17 @@ def is_retired(self):
940943
"""Is this item retired?"""
941944
return self._klass.is_retired(self._nodeid)
942945

943-
def submit(self, label=''"Submit Changes", action="edit"):
946+
def submit(self, label=''"Submit Changes", action="edit", html_kwargs={}):
944947
"""Generate a submit button.
945948
949+
"html_kwargs" specified additional html args for the
950+
generated html <select>
951+
946952
Also sneak in the lastactivity and action hidden elements.
947953
"""
948954
return \
949955
self.input(type="submit", name="submit_button",
950-
value=self._(label)) + \
956+
value=self._(label), **html_kwargs) + \
951957
'\n' + \
952958
self.input(type="hidden", name="@lastactivity",
953959
value=self.activity.local(0)) + \

share/roundup/templates/jinja2/html/issue.item.edit.html

Lines changed: 41 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,88 +6,71 @@
66
{% endif %}
77
name="itemSynopsis"
88
enctype="multipart/form-data"
9+
class="col-xl-6"
910
>
1011
<fieldset>
1112
<!-- title -->
12-
<div class='row-fluid'>
13-
<div class='control-group'>
14-
<label class='control-label' for='title'>{{ i18n.gettext('Title')|u }}</label>
15-
<div class='controls'>
16-
<input name='title' id='title' type='text' class='input-xxlarge' value='{{ context.title.plain()|u|e }}' required>
17-
</div>
13+
<div class='form-group row'>
14+
<label class='col-3 col-form-label' for='title'>{{ i18n.gettext('Title')|u }}</label>
15+
<div class='col-9'>
16+
<input class="form-control" name='title' id='title' type='text' class='input-lg' value='{{ context.title.plain()|u|e }}' required>
1817
</div>
19-
</div> <!-- row-fluid -->
18+
</div> <!-- form-group row -->
2019

2120
<!-- priority & Status -->
22-
<div class='row-fluid'>
23-
<div class='control-group span6'>
24-
<label class='control-label' for='priority'>{{ i18n.gettext('Priority')|u }}</label>
25-
<div class='controls'>
26-
{{ context.priority.menu()|u }}
27-
</div>
21+
<div class='form-group row'>
22+
<label class='col-3 col-form-label' for='priority'>{{ i18n.gettext('Priority')|u }}</label>
23+
<div class='col-3'>
24+
{{ context.priority.menu(html_kwargs={"class": "custom-select"})|u }}
2825
</div>
29-
<div class='control-group span6'>
30-
<label class='control-label' for='status'>{{ i18n.gettext('Status')|u }}</label>
31-
<div class='controls'>
32-
{{ context.status.menu()|u }}
33-
</div>
26+
<label class='col-3 col-form-label' for='status'>{{ i18n.gettext('Status')|u }}</label>
27+
<div class='col-3'>
28+
{{ context.status.menu(html_kwargs={"class": "custom-select"})|u }}
3429
</div>
35-
</div> <!-- row-fluid -->
30+
</div> <!-- form-group row -->
3631

3732
<!-- Superseder & nosy list -->
38-
<div class='row-fluid'>
39-
<div class='control-group span6'>
40-
<label class='control-label' for='superseder'>{{ i18n.gettext('Superseder')|u }}</label>
41-
<div class='controls'>
42-
<input type='text' name='superseder' id='superseder' value='{{ context.superseder.plain()|u|e }}'>
43-
</div>
33+
<div class='form-group row'>
34+
<label class='col-3 col-form-label' for='superseder'>{{ i18n.gettext('Superseder')|u }}</label>
35+
<div class='col-3'>
36+
<input class="form-control" type='text' name='superseder' id='superseder' value='{{ context.superseder.plain()|u|e }}'>
4437
</div>
45-
<div class='control-group span6'>
46-
<label class='control-label' for='nosylist'>{{ i18n.gettext('Nosy list')|u }}</label>
47-
<div class='controls'>
48-
<input type='text' name='nosy' id='nosylist' value='{{ context.nosy.plain()|u|e }}'>
49-
</div>
38+
<label class='col-3 col-form-label' for='nosylist'>{{ i18n.gettext('Nosy list')|u }}</label>
39+
<div class='col-3'>
40+
<input class="form-control" type='text' name='nosy' id='nosylist' value='{{ context.nosy.plain()|u|e }}'>
5041
</div>
51-
</div> <!-- row-fluid -->
42+
</div> <!-- form-group row -->
5243

5344
<!-- Assigned to & keywords -->
54-
<div class='row-fluid'>
55-
<div class='control-group span6'>
56-
<label class='control-label' for='assignedto'>{{ i18n.gettext('Assigned to')|u }}</label>
57-
<div class='controls'>
58-
{{ context.assignedto.menu()|u }}
59-
</div>
45+
<div class='form-group row'>
46+
<label class='col-3 col-form-label' for='assignedto'>{{ i18n.gettext('Assigned to')|u }}</label>
47+
<div class='col-3'>
48+
{{ context.assignedto.menu(html_kwargs={"class": "custom-select"})|u }}
6049
</div>
61-
<div class='control-group span6'>
62-
<label class='control-label' for='keyword'>{{ i18n.gettext('Keywords')|u }}</label>
63-
<div class='controls'>
64-
<input type='text' name='keyword' id='keyword' value='{{ context.keyword.plain()|u|e }}'>
65-
</div>
50+
<label class='col-3 col-form-label' for='keyword'>{{ i18n.gettext('Keywords')|u }}</label>
51+
<div class='col-3'>
52+
<input class="form-control" type='text' name='keyword' id='keyword' value='{{ context.keyword.plain()|u|e }}'>
6653
</div>
67-
</div> <!-- row-fluid -->
54+
</div> <!-- form-group row -->
6855

6956
<!-- Note -->
70-
<div class='row-fluid'>
71-
<div class='control-group'>
72-
<label class='control-label' for='change_note'>{{ i18n.gettext('Change note')|u }}</label>
73-
<div class='controls'>
74-
<textarea name="@note" rows="5" class='input-xxlarge' id='change_note'></textarea>
75-
</div>
57+
<div class='form-group row'>
58+
<label class='col-3 col-form-label' for='change_note'>{{ i18n.gettext('Change note')|u }}</label>
59+
<div class='col-9'>
60+
<textarea class="form-control" name="@note" rows="5" class='input-lg' id='change_note'></textarea>
7661
</div>
77-
</div> <!-- row-fluid -->
62+
</div> <!-- form-group row -->
7863

7964
<!-- File upload -->
80-
<div class='row-fluid'>
81-
<div class='control-group'>
82-
<label class='control-label' for='file_upload'>{{ i18n.gettext('File')|u }}</label>
83-
<div class='controls'>
84-
<input type="file" name="@file" id='file_upload'>
85-
</div>
65+
<div class='form-group row'>
66+
<label class='col-3 col-form-label' for='file_upload'>{{ i18n.gettext('File')|u }}</label>
67+
<div class='col-3'>
68+
<input class="form-control-file" type="file" name="@file" id='file_upload'>
8669
</div>
87-
</div> <!-- row-fluid -->
70+
</div> <!-- form-group row -->
8871
</fieldset>
8972
<div class='form-actions'>
90-
{{ context.submit() }}
73+
{{ context.submit(html_kwargs={"class": "btn btn-primary"}) }}
9174
{% if context.id %}
9275
<a href='{{ context.copy_url() }}'>{{ i18n.gettext('Make a copy')|u }}</a>
9376
{% endif %}

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{% set group_on = (group_on and group_on[1]) or 'status' %}
1010

1111
{% macro input(name, type='text') -%}
12-
<input type="{{ type }}" name="{{ name }}"
12+
<input class="form-control" type="{{ type }}" name="{{ name }}"
1313
value="{{ request.form.getvalue(name, '')|e }}" />
1414
{%- endmacro %}
1515
{% macro display_column(name) -%}
@@ -69,7 +69,7 @@
6969

7070
<tr>
7171
<th>{{ i18n.gettext('Keyword:')|u }}</th>
72-
<td><select name="keyword" id="keyword">
72+
<td><select class="custom-select" name="keyword" id="keyword">
7373
{{ option_value('keyword', '', 'don\'t care') }}
7474
{{ option_value('keyword', '-1', 'not selected') }}
7575
<option value="" disabled="disabled">------------</option>
@@ -108,7 +108,7 @@
108108

109109
<tr>
110110
<th>{{ i18n.gettext('Priority:')|u }}</th>
111-
<td><select name="priority" id="priority">
111+
<td><select class="custom-select" name="priority" id="priority">
112112
{{ option_value('priority', '', 'don\'t care') }}
113113
{{ option_value('priority', '-1', 'not selected') }}
114114
<option value="" disabled="disabled">------------</option>
@@ -123,7 +123,7 @@
123123

124124
<tr>
125125
<th>Status:</th>
126-
<td><select name="status" id="status">
126+
<td><select class="custom-select" name="status" id="status">
127127
{{ option_value('status', '', 'don\'t care') }}
128128
{{ option_value('status', '-1', 'not selected') }}
129129
{{ option_value('status', status_notresolved, 'not resolved') }}
@@ -155,12 +155,12 @@
155155

156156
<tr>
157157
<th>{{ i18n.gettext('Pagesize:')|u }}</th>
158-
<td><input name="@pagesize" size="3" value="{{ request.form.getfirst('@pagesize', '50') }}" /></td>
158+
<td><input class="form-control col-4" name="@pagesize" value="{{ request.form.getfirst('@pagesize', '50') }}" /></td>
159159
</tr>
160160

161161
<tr>
162162
<th>{{ i18n.gettext('Start With:')|u }}</th>
163-
<td><input name="@startwith" size="3" value="{{ request.form.getfirst('@startwith', '0') }}" /></td>
163+
<td><input class="form-control col-4" name="@startwith"" value="{{ request.form.getfirst('@startwith', '0') }}" /></td>
164164
</tr>
165165

166166
<tr>
@@ -178,7 +178,7 @@
178178
&nbsp;
179179
<input type="hidden" name="@action" value="search">
180180
</td>
181-
<td><input type="submit" value="Search" i18n:attributes="value"></td>
181+
<td><input class="btn btn-primary" type="submit" value="Search" i18n:attributes="value"></td>
182182
</tr>
183183

184184
<tr><td>&nbsp;</td>
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
<div class="navbar">
2-
<div class='container-fluid'>
3-
<div class='navbar-inner'>
4-
<a href="/" class='brand'><i class='icon-home'></i> {{ i18n.gettext('Roundup Demo Tracker')|u }}</a>
5-
<form name="searchform" method="get" action="bug" class='navbar-search pull-right'>
6-
<input type="hidden" name="@columns" value="{{ bug_columns_showall }}"/>
7-
<input type="hidden" name="@sort" value="-activity">
8-
<input type="hidden" name="@group" value="priority">
9-
<input type="hidden" name="@filter" value="status">
10-
<input type="hidden" name="status" value="{{ bug_status_notclosed }}"/>
11-
<input class="input-medium search-query" id="search-text" type="search" name="@search_text">
12-
<input type="submit" value="{{ i18n.gettext('search in open bugs')|u }}" name="submit" class='btn'>
13-
</form>
14-
</div> <!-- navbar-inner -->
15-
</div> <!-- container-fluid -->
1+
<div class="navbar navbar-ligh bg-light">
2+
<a href="/" class='navbar-brand'>
3+
<i class='icon-home'></i> {{ i18n.gettext('Roundup Demo Tracker')|u }}
4+
</a>
5+
<form name="searchform" method="get" action="bug" class='form-inline my-2 my-lg-0 navbar-search pull-right'>
6+
<input type="hidden" name="@columns" value="{{ bug_columns_showall }}"/>
7+
<input type="hidden" name="@sort" value="-activity">
8+
<input type="hidden" name="@group" value="priority">
9+
<input type="hidden" name="@filter" value="status">
10+
<input type="hidden" name="status" value="{{ bug_status_notclosed }}"/>
11+
<input class="form-control mr-sm-2 input-medium search-query" id="search-text" type="search" name="@search_text">
12+
<input class="form-control my-2 my-sm-0" type="submit" value="{{ i18n.gettext('search in open bugs')|u }}" name="submit" class='btn'>
13+
</form>
1614
</div> <!-- navbar -->

0 commit comments

Comments
 (0)