Fix database migrations; add cat/field/tag editing
Progress toward #4, #5, and #26
This commit is contained in:
parent
ce18ed2fd4
commit
875c5f7f06
27 changed files with 1343 additions and 46 deletions
97
src/taskflower/templates/namespace/admin/_helpers.html
Normal file
97
src/taskflower/templates/namespace/admin/_helpers.html
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
{% macro link_button_elem(obj_type, action_type, enabled, url, btn_icon, extra_cls='') %}
|
||||
<td class="pad-even">
|
||||
{% if enabled %}
|
||||
<a
|
||||
class="icon-only-btn {{extra_cls}}"
|
||||
aria-label="{{action_type}} {{obj_type}}"
|
||||
href="{{url}}"
|
||||
>{{btn_icon|safe}}</a>
|
||||
{% else %}
|
||||
<a
|
||||
class="icon-only-btn disabled"
|
||||
aria-label="Can't {{action_type}} {{obj_type}}"
|
||||
title="You don't have permission to {{action_type}} this {{obj_type}}"
|
||||
>{{icon('not-allowed')|safe}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro obj_entry(ns, obj, obj_type, edit_endpoint, delete_endpoint, tab, entries) %}
|
||||
<tr>
|
||||
{{
|
||||
link_button_elem(
|
||||
obj_type,
|
||||
'edit',
|
||||
obj.can_edit,
|
||||
url_for(
|
||||
edit_endpoint,
|
||||
id=ns.id,
|
||||
tid=obj.id,
|
||||
next=cur_page_with_variables(
|
||||
request,
|
||||
active_tab=tab
|
||||
)
|
||||
),
|
||||
icon('cog')
|
||||
)
|
||||
}}
|
||||
{{
|
||||
link_button_elem(
|
||||
obj_type,
|
||||
'delete',
|
||||
obj.can_edit,
|
||||
url_for(
|
||||
delete_endpoint,
|
||||
id=ns.id,
|
||||
tid=obj.id,
|
||||
next=cur_page_with_variables(
|
||||
request,
|
||||
active_tab=tab
|
||||
)
|
||||
),
|
||||
icon('delete'),
|
||||
'red'
|
||||
)
|
||||
}}
|
||||
{% for entry in entries %}
|
||||
<td>{{entry}}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro obj_colgroup(entries) %}
|
||||
<colgroup>
|
||||
<col span="1" style="width: 0;"/>
|
||||
<col span="1" style="width: 0;"/>
|
||||
{% for entry in entries %}
|
||||
<col span="1"/>
|
||||
{% endfor %}
|
||||
</colgroup>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro obj_header(entries) %}
|
||||
<tr>
|
||||
<th>Edit</th>
|
||||
<th>Del</th>
|
||||
{% for entry in entries %}
|
||||
<th>{{entry}}</th>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro obj_add_row(obj_type, can_add, url, entries) %}
|
||||
<tr>
|
||||
<td colspan="{{len(entries) + 2}}">
|
||||
{% if can_add %}
|
||||
<a
|
||||
class="link-btn icon-btn"
|
||||
href="{{url}}"
|
||||
>{{icon('add')|safe}} Add a new {{obj_type}}</a>
|
||||
{% else %}
|
||||
<a
|
||||
class="link-btn icon-btn disabled"
|
||||
>{{icon('not-allowed')|safe}} Add a new {{obj_type}}</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endmacro %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue