Put add comment button on single_field_panel.html

pull/7050/head
Karl Hobley 2021-04-16 11:03:34 +01:00 zatwierdzone przez Matt Westcott
rodzic b2562e612c
commit 7cf38f8750
3 zmienionych plików z 20 dodań i 5 usunięć

Wyświetl plik

@ -474,6 +474,7 @@ class FieldPanel(EditHandler):
'self': self,
self.TEMPLATE_VAR: self,
'field': self.bound_field,
'show_add_comment_button': self.comments_enabled and getattr(self.bound_field.field.widget, 'show_add_comment_button', True),
}))
field_template = "wagtailadmin/edit_handlers/field_panel_field.html"

Wyświetl plik

@ -1,8 +1,18 @@
{% load i18n %}
<fieldset>
<legend>{{ self.heading }}</legend>
<ul class="fields">
<li>
{% include "wagtailadmin/shared/field.html" with show_label=False show_help_text=False %}
{% include "wagtailadmin/shared/field.html" with show_label=False show_help_text=False show_add_comment_button=False %}
</li>
</ul>
</fieldset>
{% if show_add_comment_button %}
<div class="field-comment-control" data-contentpath="{{ self.field_name }}">
<button type="button" data-component="add-comment-button" class="button button-secondary button-small u-hidden" aria-label="{% trans 'Add comment' %}">
<svg class="icon icon-comment-add initial" aria-hidden="true" focusable="false"><use href="#icon-comment-add"></use></svg>
</button>
</div>
{% endif %}

Wyświetl plik

@ -21,9 +21,13 @@
{% endfor %}
</p>
{% endif %}
{% if show_add_comment_button %}
<button type="button" data-component="add-comment-button" class="button button-secondary button-small u-hidden" aria-label="{% trans 'Add comment' %}"><svg class="icon icon-comment initial" aria-hidden="true" focusable="false"><use href="#icon-comment"></use></svg></button>
{% endif %}
</div>
{% if show_add_comment_button %}
<div class="field-comment-control">
<button type="button" data-component="add-comment-button" class="button button-secondary button-small u-hidden" aria-label="{% trans 'Add comment' %}">
<svg class="icon icon-comment-add initial" aria-hidden="true" focusable="false"><use href="#icon-comment-add"></use></svg>
</button>
</div>
{% endif %}
</div>