kopia lustrzana https://github.com/wagtail/wagtail
Use teal background color for footer actions when reverting revisions
Fixes color contrast issue with the buttons and makes them more consistent with the 'normal' variant (not reverting a revision).pull/12425/head
rodzic
4b54e79d7b
commit
2f476e10b0
|
@ -1,5 +1,5 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
<button type="submit" class="button action-save {% if is_revision %}warning{% endif %}" disabled>
|
||||
<button type="submit" class="button action-save" disabled>
|
||||
{% if icon_name %}{% icon name=icon_name %}{% endif %}
|
||||
{% trans 'Page locked' %}
|
||||
</button>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
type="submit"
|
||||
name="action-publish"
|
||||
value="action-publish"
|
||||
class="button button-longrunning {% if is_revision %}warning{% endif %}"
|
||||
class="button button-longrunning"
|
||||
data-controller="w-progress"
|
||||
data-action="w-progress#activate"
|
||||
data-w-progress-active-value="{% trans 'Publishing…' %}"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
<button
|
||||
type="submit"
|
||||
class="button action-save button-longrunning {% if is_revision %}warning{% endif %}"
|
||||
class="button action-save button-longrunning"
|
||||
data-controller="w-progress w-kbd"
|
||||
data-action="w-progress#activate"
|
||||
data-w-kbd-key-value="mod+s"
|
||||
|
|
|
@ -1894,7 +1894,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# submit for approval
|
||||
|
@ -1910,7 +1910,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After submit, as a moderator, should only see save, approve, and reject buttons
|
||||
|
@ -1924,7 +1924,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
self.reject()
|
||||
|
@ -1940,7 +1940,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After cancel, as a submitter, should only see save and submit buttons
|
||||
|
@ -1953,7 +1953,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
def test_workflow_action_menu_items_when_reverting(self):
|
||||
|
@ -1973,7 +1973,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# submit for approval
|
||||
|
@ -1989,7 +1989,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After submit, as a moderator, should only see save button
|
||||
|
@ -2003,7 +2003,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
self.reject()
|
||||
|
@ -2019,7 +2019,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After cancel, as a submitter, should only see save button
|
||||
|
@ -2033,7 +2033,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
@override_settings(WAGTAILADMIN_BASE_URL="http://admin.example.com")
|
||||
|
@ -2180,7 +2180,7 @@ class TestSubmitPageToWorkflow(BasePageWorkflowTests):
|
|||
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save " disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
self.assertNotContains(
|
||||
response,
|
||||
|
@ -2245,7 +2245,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# submit for approval
|
||||
|
@ -2262,7 +2262,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After submit, as a moderator, should only see save, approve, and reject buttons
|
||||
|
@ -2276,7 +2276,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
self.reject()
|
||||
|
@ -2292,7 +2292,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
def test_workflow_action_menu_items_when_reverting(self):
|
||||
|
@ -2312,7 +2312,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# submit for approval
|
||||
|
@ -2329,7 +2329,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
# After submit, as a moderator, should only see save button
|
||||
|
@ -2343,7 +2343,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
self.reject()
|
||||
|
@ -2359,7 +2359,7 @@ class TestSubmitSnippetToWorkflowNotLockable(TestSubmitSnippetToWorkflow):
|
|||
self.assertNotContains(response, "Request changes")
|
||||
self.assertNotContains(
|
||||
response,
|
||||
'<button type="submit" class="button action-save warning" disabled>',
|
||||
'<button type="submit" class="button action-save" disabled>',
|
||||
)
|
||||
|
||||
def test_submit_for_approval_changes_lock_status(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
<button type="submit" class="button action-save {% if is_revision %}warning{% endif %}" disabled>
|
||||
<button type="submit" class="button action-save" disabled>
|
||||
{% if icon_name %}{% icon name=icon_name %}{% endif %}
|
||||
{% trans 'Locked' %}
|
||||
</button>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% load wagtailadmin_tags %}
|
||||
{% if url %}
|
||||
<a class="button{% if classname %} {{ classname }}{% endif %}{% if is_revision %} warning{% endif %}" href="{{ url }}">{% if icon_name %}{% icon name=icon_name %}{% endif %}{{ label }}</a>
|
||||
<a class="button{% if classname %} {{ classname }}{% endif %}" href="{{ url }}">{% if icon_name %}{% icon name=icon_name %}{% endif %}{{ label }}</a>
|
||||
{% else %}
|
||||
<button type="submit" name="{{ name }}" value="{{ label }}" class="button{% if classname %} {{ classname }}{% endif %}{% if is_revision %} warning{% endif %}">{% if icon_name %}{% icon name=icon_name %}{% endif %}{{ label }}</button>
|
||||
<button type="submit" name="{{ name }}" value="{{ label }}" class="button{% if classname %} {{ classname }}{% endif %}">{% if icon_name %}{% icon name=icon_name %}{% endif %}{{ label }}</button>
|
||||
{% endif %}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
type="submit"
|
||||
name="{{ name }}"
|
||||
value="{{ name }}"
|
||||
class="button action-save button-longrunning{% if is_revision %} warning{% endif %}"
|
||||
class="button action-save button-longrunning"
|
||||
data-controller="w-progress w-kbd"
|
||||
data-action="w-progress#activate"
|
||||
data-w-kbd-key-value="mod+s"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% load i18n wagtailadmin_tags %}
|
||||
<button
|
||||
type="submit"
|
||||
class="button action-save button-longrunning{% if is_revision %} warning{% endif %}"
|
||||
class="button action-save button-longrunning"
|
||||
data-controller="w-progress w-kbd"
|
||||
data-action="w-progress#activate"
|
||||
data-w-kbd-key-value="mod+s"
|
||||
|
|
|
@ -4557,15 +4557,24 @@ class TestSnippetRevisions(WagtailTestUtils, TestCase):
|
|||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTemplateUsed(response, "wagtailsnippets/snippets/edit.html")
|
||||
soup = self.get_soup(response.content)
|
||||
|
||||
# The save button should be labelled "Replace current draft"
|
||||
self.assertContains(response, "Replace current draft")
|
||||
# The publish button should exist
|
||||
self.assertContains(response, "Publish this version")
|
||||
# The publish button should have name="action-publish"
|
||||
self.assertContains(
|
||||
response,
|
||||
'<button\n type="submit"\n name="action-publish"\n value="action-publish"\n class="button action-save button-longrunning warning"\n data-controller="w-progress w-kbd"\n data-action="w-progress#activate"\n data-w-kbd-key-value="mod+s"\n',
|
||||
footer = soup.select_one("footer")
|
||||
save_button = footer.select_one(
|
||||
'button[type="submit"]:not([name="action-publish"])'
|
||||
)
|
||||
self.assertIsNotNone(save_button)
|
||||
self.assertEqual(save_button.text.strip(), "Replace current draft")
|
||||
# The publish button should exist and have name="action-publish"
|
||||
publish_button = footer.select_one(
|
||||
'button[type="submit"][name="action-publish"]'
|
||||
)
|
||||
self.assertIsNotNone(publish_button)
|
||||
self.assertEqual(publish_button.text.strip(), "Publish this version")
|
||||
self.assertEqual(
|
||||
set(publish_button.get("class")),
|
||||
{"button", "action-save", "button-longrunning"},
|
||||
)
|
||||
|
||||
# Should not show the Unpublish action menu item
|
||||
|
@ -4573,11 +4582,8 @@ class TestSnippetRevisions(WagtailTestUtils, TestCase):
|
|||
"wagtailsnippets_tests_draftstatemodel:unpublish",
|
||||
args=(quote(self.snippet.pk),),
|
||||
)
|
||||
self.assertNotContains(
|
||||
response,
|
||||
f'<a class="button action-secondary" href="{unpublish_url}">',
|
||||
)
|
||||
self.assertNotContains(response, "Unpublish")
|
||||
unpublish_button = footer.select_one(f'a[href="{unpublish_url}"]')
|
||||
self.assertIsNone(unpublish_button)
|
||||
|
||||
def test_get_with_previewable_snippet(self):
|
||||
self.snippet = MultiPreviewModesModel.objects.create(text="Preview-enabled foo")
|
||||
|
|
Ładowanie…
Reference in New Issue