From bd3602310073edde7220a61ca85dbf128e8ee6ac Mon Sep 17 00:00:00 2001 From: Tom Carrick Date: Wed, 17 Aug 2022 18:01:35 +0200 Subject: [PATCH] Used CSS flex for admin's submit row. --- .../contrib/admin/static/admin/css/forms.css | 21 +++++++++---------- .../admin/static/admin/css/responsive.css | 17 +++++---------- django/contrib/admin/static/admin/css/rtl.css | 13 +++--------- .../admin/templates/admin/submit_line.html | 2 +- tests/admin_inlines/tests.py | 5 ++++- 5 files changed, 23 insertions(+), 35 deletions(-) diff --git a/django/contrib/admin/static/admin/css/forms.css b/django/contrib/admin/static/admin/css/forms.css index 59f61cbc02..a326b3baf7 100644 --- a/django/contrib/admin/static/admin/css/forms.css +++ b/django/contrib/admin/static/admin/css/forms.css @@ -254,12 +254,15 @@ fieldset.monospace textarea { /* SUBMIT ROW */ .submit-row { - padding: 12px 14px 7px; + padding: 12px 14px 12px; margin: 0 0 20px; background: var(--darkened-bg); border: 1px solid var(--hairline-color); border-radius: 4px; overflow: hidden; + display: flex; + gap: 10px; + flex-wrap: wrap; } body.popup .submit-row { @@ -269,20 +272,18 @@ body.popup .submit-row { .submit-row input { height: 35px; line-height: 15px; - margin: 0 5px 5px 0; +} + +.submit-row input, .submit-row a { + margin: 0; } .submit-row input.default { text-transform: uppercase; } -.submit-row p { - margin: 0.3em; -} - -.submit-row p.deletelink-box { - float: right; - margin: 0; +.submit-row a.deletelink { + margin-left: auto; } .submit-row a.deletelink { @@ -292,7 +293,6 @@ body.popup .submit-row { padding: 10px 15px; height: 15px; line-height: 15px; - margin-bottom: 5px; color: var(--button-fg); } @@ -303,7 +303,6 @@ body.popup .submit-row { padding: 10px 15px; height: 15px; line-height: 15px; - margin: 0 5px 5px 0; color: var(--button-fg); } diff --git a/django/contrib/admin/static/admin/css/responsive.css b/django/contrib/admin/static/admin/css/responsive.css index 4b95e63f15..ad6a5cb085 100644 --- a/django/contrib/admin/static/admin/css/responsive.css +++ b/django/contrib/admin/static/admin/css/responsive.css @@ -232,7 +232,7 @@ input[type="submit"], button { } .submit-row { - padding: 8px 8px 3px 8px; + padding: 8px; } .submit-row a.deletelink { @@ -819,30 +819,23 @@ input[type="submit"], button { /* Submit row */ .submit-row { - padding: 10px 10px 5px; + padding: 10px; margin: 0 0 15px; - display: flex; flex-direction: column; - } - - .submit-row > * { - width: 100%; + gap: 8px; } .submit-row input, .submit-row input.default, .submit-row a { - float: none; - margin: 0 0 10px; text-align: center; } .submit-row a.closelink { - float: none; padding: 10px 0; text-align: center; } - .submit-row p.deletelink-box { - order: 4; + .submit-row a.deletelink { + margin: 0; } /* Messages */ diff --git a/django/contrib/admin/static/admin/css/rtl.css b/django/contrib/admin/static/admin/css/rtl.css index 7ccbd282a5..bde0409275 100644 --- a/django/contrib/admin/static/admin/css/rtl.css +++ b/django/contrib/admin/static/admin/css/rtl.css @@ -114,16 +114,9 @@ thead th.sorted .text { float: right; } -.submit-row p.deletelink-box { - float: left; -} - -.submit-row input.default { - margin: 0 0 5px 5px; -} - -.submit-row input { - margin: 0 0 5px 5px; +.submit-row a.deletelink { + margin-left: 0; + margin-right: auto; } .vDateField, .vTimeField { diff --git a/django/contrib/admin/templates/admin/submit_line.html b/django/contrib/admin/templates/admin/submit_line.html index 3582f054be..a1082ed196 100644 --- a/django/contrib/admin/templates/admin/submit_line.html +++ b/django/contrib/admin/templates/admin/submit_line.html @@ -8,7 +8,7 @@ {% if show_close %}{% translate 'Close' %}{% endif %} {% if show_delete_link and original %} {% url opts|admin_urlname:'delete' original.pk|admin_urlquote as delete_url %} - + {% translate "Delete" %} {% endif %} {% endblock %} diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py index aab20dfd55..ad7446e1ca 100644 --- a/tests/admin_inlines/tests.py +++ b/tests/admin_inlines/tests.py @@ -1303,7 +1303,10 @@ class TestReadOnlyChangeViewInlinePermissions(TestCase): 'Close', html=True, ) - delete_link = '' # noqa + delete_link = ( + 'Delete' + "" + ) self.assertNotContains(response, delete_link % self.poll.id, html=True) self.assertNotContains( response,