mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-18 05:29:38 -04:00
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:
@@ -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' %}
|
||||
|
||||
Reference in New Issue
Block a user