adopt `classname` naming in dialog toggle template tag

pull/9713/head
LB Johnston 2022-07-21 21:36:52 +10:00 zatwierdzone przez Matt Westcott
rodzic 71f3738e8c
commit 6cf16bf5d5
5 zmienionych plików z 15 dodań i 16 usunięć

Wyświetl plik

@ -1,12 +1,11 @@
{% load wagtailadmin_tags %}
{% comment %}
{% comment "text/markdown" %}
Variables this template accepts:
dialog_id - The ID of the dialog you are toggling open
class_name - CSS classes for styling the button
classname - CSS classes for styling the button
text - The text of the button
{% endcomment %}
<button type="button" class="{{ class_name }}" data-a11y-dialog-show="{{ dialog_id }}">
<button type="button" class="{{ classname }}" data-a11y-dialog-show="{{ dialog_id }}">
{{ text }}
</button>

Wyświetl plik

@ -32,7 +32,7 @@
{% page_permissions page as page_perms %}
{% if page.id and page_perms.can_set_view_restrictions %}
{% trans 'Change privacy' as set_privacy_title %}
{% dialog_toggle class_name='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id='set-privacy' text=set_privacy_title %}
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id='set-privacy' text=set_privacy_title %}
{% else %}
{# Empty actions block because of lack of permissions #}
{% endif %}

Wyświetl plik

@ -50,7 +50,7 @@
</div>
{% if show_schedule_publishing_toggle and not has_draft_publishing_schedule and not page_perms.page_locked %}
{% trans 'Edit schedule' as edit_schedule_text %}
{% dialog_toggle class_name='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=edit_schedule_text %}
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=edit_schedule_text %}
{% endif %}
</div>
</div>
@ -93,7 +93,7 @@
{% block action %}
{% if workflow_state and not hide_action %}
{% trans 'Moderators approval' as workflow_dialog_title %}
{% dialog_toggle class_name='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="workflow-status-dialog" text=action_text %}
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="workflow-status-dialog" text=action_text %}
{# info subtitle #}
{% if object.get_latest_revision %}
@ -160,7 +160,7 @@
</div>
{% if show_schedule_publishing_toggle and not page_perms.page_locked %}
{% trans 'Edit schedule' as edit_schedule_text %}
{% dialog_toggle class_name='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=edit_schedule_text %}
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=edit_schedule_text %}
{% endif %}
</div>
</div>
@ -169,7 +169,7 @@
<div class="w-ml-8 w-pr-4 w-label-3">{% trans 'No publishing schedule set' %}</div>
{% if show_schedule_publishing_toggle and not page_perms.page_locked %}
{% trans 'Set schedule' as set_schedule_text %}
{% dialog_toggle class_name='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=set_schedule_text %}
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-secondary hover:w-text-secondary-600 w-inline-flex w-justify-center w-transition' dialog_id="schedule-publishing-dialog" text=set_schedule_text %}
{% endif %}
</div>
{% endif %}

Wyświetl plik

@ -1086,12 +1086,12 @@ register.tag("field_row", FieldRowNode.handle)
# Button used to open dialogs
@register.inclusion_tag("wagtailadmin/shared/dialog/dialog_toggle.html")
def dialog_toggle(dialog_id, class_name="", text=None):
def dialog_toggle(dialog_id, classname="", text=None):
if not dialog_id:
raise ValueError("You must supply the dialog ID")
return {
"class_name": class_name,
"classname": classname,
"text": text,
# dialog_id must match the ID of the dialog you are toggling
"dialog_id": dialog_id,

Wyświetl plik

@ -456,35 +456,35 @@
<div class="w-flex w-gap-4">
<div>
{% dialog_toggle class_name='button button-primary' dialog_id='dialog-1' text='Simple dialog' %}
{% dialog_toggle classname='button button-primary' dialog_id='dialog-1' text='Simple dialog' %}
{% dialog icon_name="doc-full-inverse" id="dialog-1" title="Simple dialog" subtitle="This is as simple as it gets 😀" %}
<p class="w-base-text">This is an example of a simple dialog with an icon_name, title and subtitle passed to the dialog tag</p>
{% enddialog %}
</div>
<div>
{% dialog_toggle class_name='button button-primary' dialog_id='dialog-2' text='Dialog with info' %}
{% dialog_toggle classname='button button-primary' dialog_id='dialog-2' text='Dialog with info' %}
{% dialog icon_name="globe" title="Dialog with info" id="dialog-2" subtitle="This is a testing subtitle" message_status="info" message_heading="Here is some info on the thing" message_description="This is a subtext for the message" %}
<p class="w-base-text">This dialog message was generated by passing message_status=info as well as message_heading and message_description to the dialog template tag</p>
{% enddialog %}
</div>
<div>
{% dialog_toggle class_name='button button-primary' dialog_id='dialog-3' text='Dialog with success' %}
{% dialog_toggle classname='button button-primary' dialog_id='dialog-3' text='Dialog with success' %}
{% dialog icon_name="globe" title="Dialog with success" id="dialog-3" subtitle="This is a testing subtitle" message_status="success" message_heading="Success! You've done the thing" %}
<p class="w-base-text">This dialog message was generated by passing message_status=success as well as message_heading to the dialog template tag</p>
{% enddialog %}
</div>
<div>
{% dialog_toggle class_name='button button-primary' dialog_id='dialog-4' text='Dialog with warning' %}
{% dialog_toggle classname='button button-primary' dialog_id='dialog-4' text='Dialog with warning' %}
{% dialog icon_name="globe" title="Dialog with warning" id="dialog-4" subtitle="This is a testing subtitle" message_status="warning" message_heading="There was an issue with the thing" message_description="This is a subtext for the message" %}
<p class="w-base-text">This dialog message was generated by passing message_status=warning as well as message_heading and message_description to the dialog template tag</p>
{% enddialog %}
</div>
<div>
{% dialog_toggle class_name='button button-primary' dialog_id='dialog-5' text='Dialog with error' %}
{% dialog_toggle classname='button button-primary' dialog_id='dialog-5' text='Dialog with error' %}
{% dialog icon_name="globe" title="Dialog with critical error" id="dialog-5" subtitle="This is a testing subtitle" message_status="critical" message_heading="There was an issue with the thing" message_description="This is a subtext for the message" %}
<p class="w-base-text">This dialog message was generated by passing message_status=critical as well as message_heading and message_description to the dialog template tag</p>