Add hints to update config form

This commit is contained in:
rubenwardy 2021-01-30 15:22:19 +00:00
parent 1b296fcae5
commit 0cd23f7883
2 changed files with 9 additions and 14 deletions

@ -4,13 +4,16 @@
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
{% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None) -%} {% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None, hint=None) -%}
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}"> <div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
{% if field.type != 'HiddenField' and label_visible %} {% if field.type != 'HiddenField' and label_visible %}
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %} {% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
{% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %} {% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %}
{% endif %} {% endif %}
{{ field(class_=fieldclass or 'form-control', **kwargs) }} {{ field(class_=fieldclass or 'form-control', **kwargs) }}
{% if hint %}
<small class="form-text text-muted">{{ hint | safe }}</small>
{% endif %}
{{ render_errors(field) }} {{ render_errors(field) }}
</div> </div>
{%- endmacro %} {%- endmacro %}

@ -22,21 +22,13 @@
<form method="POST" action=""> <form method="POST" action="">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{{ render_field(form.trigger, class_="mt-5") }} {{ render_field(form.trigger, class_="mt-5", hint=_("The event which triggers the action to occur.")) }}
{{ render_field(form.ref, placeholder="Leave blank to use default branch", {{ render_field(form.ref, placeholder=_("Leave blank to use default branch"),
pattern="[A-Za-z0-9/._-]+") }} pattern="[A-Za-z0-9/._-]+",
hint=_("Currently, the branch name field is only used by the New Commit trigger.")) }}
<p class="text-muted mb-4 mt-0"> {{ render_field(form.action, hint=_("The action to perform.")) }}
<small>
<span class="fas fa-info mx-1"></span>
{{ _("Currently, the branch name field is only used by the New Commit trigger.") }}
</small>
</p>
{{ render_field(form.action) }}
<p class="mt-5"> <p class="mt-5">
{{ render_submit_field(form.submit) }} {{ render_submit_field(form.submit) }}