Compare commits

..

1 Commits

Author SHA1 Message Date
Frédéric Péters dfab955432 blocks: add support for post conditions (#71778)
gitea/wcs/pipeline/head This commit looks good Details
2024-03-12 12:15:26 +01:00
2 changed files with 4 additions and 4 deletions

View File

@ -544,9 +544,9 @@ class BlockWidget(WidgetList):
if self.required and self.value is None:
self.set_error(_(self.REQUIRED_ERROR))
for widget in self.widgets:
# do not mark individual rows as required
if widget.error == self.REQUIRED_ERROR:
widget.clear_error()
# mark required rows with a special attribute, to avoid doubling the
# error messages in the template.
widget.is_required_error = bool(widget.error == self.REQUIRED_ERROR)
return self.value
def add_media(self):

View File

@ -6,7 +6,7 @@
{% endblock %}
{% block widget-content %}
{% if not widget.readonly and widget.error %}<div class="error"><p>{{ widget.error }}</p></div>{% endif %}
{% if not widget.readonly and widget.error and not widget.is_required_error %}<div class="error"><p>{{ widget.error }}</p></div>{% endif %}
{% for subwidget in widget.get_widgets %}
{% if widget.readonly and not subwidget.field.include_in_validation_page %}<div style="display: none">{% endif %}
{{ subwidget.render|safe }}