Refactor SaveButton

This commit is contained in:
leigh-mil 2019-04-06 15:34:01 -04:00
parent 5aae1691a2
commit 5e77c4f29c

View File

@ -1,8 +1,10 @@
{% macro SaveButton(text, element="button", additional_classes="", other_attrs="") -%}
{% macro SaveButton(text, element="button", additional_classes="", form=None) -%}
{% set class = "usa-button usa-button-primary" + additional_classes %}
<{{ element }} type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed" value="{{ text }}" {{ other_attrs }}>
{% if element == 'button'%}
{% if element == "button" %}
<button type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed" {{ form_attr }} >
{{ text }}
{% endif %}
</{{ element }}>
</button>
{% elif element == 'input' %}
<input type="submit" class="{{ class }}" tabindex="0" v-bind:disabled="!changed" value="{{ text }}" {% if form %}form="{{ form }}"{% endif %} />
{% endif %}
{%- endmacro %}