Mark optional fields as optionals

Fix #121
This commit is contained in:
Bat 2018-07-19 11:14:44 +02:00
parent 9701340c84
commit 8ad0abd921
7 changed files with 26 additions and 4 deletions

View File

@ -336,3 +336,6 @@ msgstr[1] "Du bist kein Autor in diesem Blog."
msgid "Login or use your Fediverse account to interact with this article"
msgstr ""
msgid "Optional"
msgstr ""

View File

@ -329,3 +329,6 @@ msgstr[1] ""
msgid "Login or use your Fediverse account to interact with this article"
msgstr ""
msgid "Optional"
msgstr ""

View File

@ -329,4 +329,9 @@ msgstr[0] "{{ count }} aut⋅eur⋅rice dans ce blog : "
msgstr[1] "{{ count }} aut⋅eur⋅rice⋅s dans ce blog : "
msgid "Login or use your Fediverse account to interact with this article"
msgstr "Connectez-vous ou utilisez votre compte sur le Fediverse pour interagir avec cet article"
msgstr ""
"Connectez-vous ou utilisez votre compte sur le Fediverse pour interagir avec "
"cet article"
msgid "Optional"
msgstr "Optionnel"

View File

@ -339,5 +339,8 @@ msgstr[2] "Nie jesteś autorem tego bloga."
msgid "Login or use your Fediverse account to interact with this article"
msgstr ""
msgid "Optional"
msgstr ""
#~ msgid "Logowanie"
#~ msgstr "Zaloguj się"

View File

@ -322,3 +322,6 @@ msgstr[1] ""
msgid "Login or use your Fediverse account to interact with this article"
msgstr ""
msgid "Optional"
msgstr ""

View File

@ -21,8 +21,13 @@
</p>
</div>
{% endmacro post_card %}
{% macro input(name, label, errors, form, type="text", props="") %}
<label for="{{ name }}">{{ label | _ }}</label>
{% macro input(name, label, errors, form, type="text", props="", optional=false) %}
<label for="{{ name }}">
{{ label | _ }}
{% if optional %}
<small>{{ "Optional" | _ }}</small>
{% endif %}
</label>
{% if errors is defined and errors[name] %}
{% for err in errors[name] %}
<p class="error">{{ err.message | default(value="Unknown error") | _ }}</p>

View File

@ -19,7 +19,7 @@
<label for="content">{{ "Content" | _ }}</label>
<textarea id="content" name="content" value="{{ form.content | default(value="") }}"></textarea>
{{ macros::input(name="license", label="License", errors=errors, form=form) }}
{{ macros::input(name="license", label="License", errors=errors, form=form, optional=true) }}
<input type="submit" value="{{ "Publish" | _ }}" />
</form>