misc: explicit forms optional fields and add class to mark them (#40156)

This commit is contained in:
Serghei Mihai 2020-08-11 16:59:09 +02:00
parent a71378bd9e
commit 3de06b1970
2 changed files with 23 additions and 1 deletions

View File

@ -399,3 +399,21 @@ form.small button + a.button {
.field-live-hint button.close::after {
content: "×";
}
form {
.widget-optional span.optional {
display: none;
}
}
form.pk-mark-optional-fields {
.widget-required {
span.required {
display: none;
}
}
.widget-optional span.optional {
display: inline;
font-style: italic;
}
}

View File

@ -7,7 +7,11 @@
{% block widget-title %}
<div class="title">
{{ field.label_tag }}
{% if field.field.required %}<span title="{% trans "This field is required." %}" class="required">*</span>{% endif %}
{% if field.field.required %}
<span title="{% trans "This field is required." %}" class="required">*</span>
{% else %}
<span class="optional">{% trans "(optional)" %}</span>
{% endif %}
</div>
{% endblock %}
{% block widget-content %}