Add Jinja macro for a row on the settings page

Often we show/hide these rows based on what permissions a service has.
This commits refactors that check into a reusable macro, rather than
having to write the same `if` statements all the time.
This commit is contained in:
Chris Hill-Scott
2018-07-09 16:58:04 +01:00
parent c30b86714e
commit a35ce8eb89
2 changed files with 105 additions and 108 deletions

View File

@@ -56,6 +56,15 @@
</tbody>
{%- endmacro %}
{% macro settings_row(if_has_permission='') -%}
{% set parent_caller = caller %}
{% if if_has_permission in current_service.permissions %}
{% call row() %}
{{ parent_caller() }}
{% endcall %}
{% endif %}
{%- endmacro %}
{% macro field(align='left', status='', border=True) -%}
{% set field_alignment = 'table-field-right-aligned' if align == 'right' else 'table-field-center-aligned' %}