home · contact · privacy
Simplify and improve previous bugfix.
[plomtask] / templates / _macros.html
index 25d94c58ce72a0a52f483c3251a30f9c3496ab51..a19c06381320461baf7b1622b475d7d0d244440b 100644 (file)
@@ -17,7 +17,8 @@
 
 
 
-{% macro simple_checkbox_table(title, items, type_name, list_name, add_string="add") %}
+{% macro simple_checkbox_table(title, items, type_name, list_name, add_string="add", historical=false) %}
+{% if items|length > 0 %}
 <table>
 {% for item in items %}
 <tr>
 <input type="checkbox" name="{{title}}" value="{{item.id_}}" checked />
 </td>
 <td>
-<a href="{{type_name}}?id={{item.id_}}">{{item.title.newest|e}}</a>
+<a href="{{type_name}}?id={{item.id_}}">{% if historical is true %}{{item.title_then}}{% else %}{{item.title.newest|e}}{% endif %}</a>
 </td>
 </tr>
 {% endfor %}
 </table>
-{{add_string}}: <input name="{{title}}" list="{{list_name}}" autocomplete="off" />
+{% endif %}
+{{add_string}}: <input name="{{title}}" type="text" list="{{list_name}}" autocomplete="off" />
 {% endmacro %}
 
 
 
 {% macro history_page(item_name, item, attribute_name, attribute, as_pre=false) %}
 <h3>{{item_name}} {{attribute_name}} history</h3>
+<form action="{{item_name}}_{{attribute_name}}s?id={{item.id_}}" method="POST">
 <table>
 
 <tr>
 <td><a href="{{item_name}}?id={{item.id_}}">{{item.title.newest|e}}</a></td>
 </tr>
 
+
 {% for date in attribute.history.keys() | sort(reverse=True) %}
 <tr>
-<th>{{date | truncate(19, True, '') }}</th>
+<td><input name="at:{{date}}" class="timestamp" value="{{date|truncate(19, True, '', 0)}}"></td>
 <td>{% if as_pre %}<pre>{% endif %}{{attribute.history[date]}}{% if as_pre %}</pre>{% endif %}</td>
 </tr>
 {% endfor %}
 
 </table>
+<input class="btn-harmless" type="submit" name="update" value="update" />
+</form>
 {% endmacro %}