home · contact · privacy
Slightly improve and re-organize Condition tests.
[plomtask] / templates / _macros.html
1 {% macro edit_buttons() %}
2 <input class="btn-harmless" type="submit" name="update" value="update" />
3 <div class="btn-to-right">
4 <input class="btn-dangerous" type="submit" name="delete" value="delete" />
5 </div>
6 {% endmacro %}
7
8
9
10 {% macro datalist_of_titles(title, candidates) %}
11 <datalist id="{{title}}">
12 {% for candidate in candidates %}
13 <option value="{{candidate.id_}}">{{candidate.title.newest|e}}</option>
14 {% endfor %}
15 </datalist>
16 {% endmacro %}
17
18
19
20 {% macro simple_checkbox_table(title, items, type_name, list_name, add_string="add") %}
21 <table>
22 {% for item in items %}
23 <tr>
24 <td>
25 <input type="checkbox" name="{{title}}" value="{{item.id_}}" checked />
26 </td>
27 <td>
28 <a href="{{type_name}}?id={{item.id_}}">{{item.title.newest|e}}</a>
29 </td>
30 </tr>
31 {% endfor %}
32 </table>
33 {{add_string}}: <input name="{{title}}" list="{{list_name}}" autocomplete="off" />
34 {% endmacro %}
35
36
37
38 {% macro history_page(item_name, item, attribute_name, attribute, as_pre=false) %}
39 <h3>{{item_name}} {{attribute_name}} history</h3>
40 <table>
41
42 <tr>
43 <th>{{item_name}}</th>
44 <td><a href="{{item_name}}?id={{item.id_}}">{{item.title.newest|e}}</a></td>
45 </tr>
46
47 {% for date in attribute.history.keys() | sort(reverse=True) %}
48 <tr>
49 <th>{{date | truncate(19, True, '') }}</th>
50 <td>{% if as_pre %}<pre>{% endif %}{{attribute.history[date]}}{% if as_pre %}</pre>{% endif %}</td>
51 </tr>
52 {% endfor %}
53
54 </table>
55 {% endmacro %}