diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-05-02 15:16:39 -0700 |
|---|---|---|
| committer | Carlton Gibson <carlton@noumenal.es> | 2020-06-25 11:46:05 +0200 |
| commit | 60db8b7b376c107d7bd5068b713e783e52d134bc (patch) | |
| tree | 64e74726e7b343fab2cb3cee6e9bdc5d44ba74e2 | |
| parent | e13cfc6dfd4212ef7a40db1a41d3ae6ac4b97de0 (diff) | |
Removed unnecessary admin CSS.
The "object-tools" container is never rendered as a descendant of
.form-row.
The "golink" CSS class is unused.
A <label> element has not been included in the login .submit-row since
5869afe32b9c252cacd327f18c58e38c36d1f530.
The "help" CSS class from login.css has been unused since
0e5faf225c5cd1acf2ab653c74f5b161470403b9.
The <label> color in login.css is already inherited from the <body>
element and so does not need to be re-specified.
The #content-main container already has the property 'width: 100%' from
base.css and so does not need to be re-specified in login.css.
The <td> and <th> font-family property is inherited from the <body>
element and so does not need to be re-specified.
The <html> element has the attribute dir which automatically sets
the text direction in the layout. Adding the direction CSS property was
necessary to support IE which does not support the dir attribute, but IE
is no longer supported, so drop the direction property.
The 'font-size: 1em' property re-specifies the same font size. It
creates no visual difference.
The 'font-size: 14px' property often re-specifies the inherited value.
Avoid re-specifying it.
| -rw-r--r-- | django/contrib/admin/static/admin/css/base.css | 15 | ||||
| -rw-r--r-- | django/contrib/admin/static/admin/css/changelists.css | 1 | ||||
| -rw-r--r-- | django/contrib/admin/static/admin/css/login.css | 11 | ||||
| -rw-r--r-- | django/contrib/admin/static/admin/css/responsive.css | 2 | ||||
| -rw-r--r-- | django/contrib/admin/static/admin/css/rtl.css | 4 | ||||
| -rw-r--r-- | tests/admin_views/tests.py | 17 |
6 files changed, 20 insertions, 30 deletions
diff --git a/django/contrib/admin/static/admin/css/base.css b/django/contrib/admin/static/admin/css/base.css index 76316dbb1f..18ff846d3b 100644 --- a/django/contrib/admin/static/admin/css/base.css +++ b/django/contrib/admin/static/admin/css/base.css @@ -228,7 +228,6 @@ td, th { border-bottom: 1px solid #eee; vertical-align: top; padding: 8px; - font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif; } th { @@ -615,7 +614,6 @@ div.breadcrumbs { background: #79aec8; padding: 10px 40px; border: none; - font-size: 14px; color: #c4dce8; text-align: left; } @@ -670,14 +668,6 @@ a.deletelink:focus, a.deletelink:hover { margin-top: -48px; } -.form-row .object-tools { - margin-top: 5px; - margin-bottom: 5px; - float: none; - height: 2em; - padding-left: 3.5em; -} - .object-tools li { display: block; float: left; @@ -709,13 +699,13 @@ a.deletelink:focus, a.deletelink:hover { text-decoration: none; } -.object-tools a.viewsitelink, .object-tools a.golink,.object-tools a.addlink { +.object-tools a.viewsitelink, .object-tools a.addlink { background-repeat: no-repeat; background-position: right 7px center; padding-right: 26px; } -.object-tools a.viewsitelink, .object-tools a.golink { +.object-tools a.viewsitelink { background-image: url(../img/tooltag-arrowright.svg); } @@ -890,7 +880,6 @@ table#change-history tbody th { } #content-related h3 { - font-size: 14px; color: #666; padding: 0 16px; margin: 0 0 16px; diff --git a/django/contrib/admin/static/admin/css/changelists.css b/django/contrib/admin/static/admin/css/changelists.css index 477429df14..aec7404ce2 100644 --- a/django/contrib/admin/static/admin/css/changelists.css +++ b/django/contrib/admin/static/admin/css/changelists.css @@ -142,7 +142,6 @@ #changelist-filter h3 { font-weight: 400; - font-size: 14px; padding: 0 15px; margin-bottom: 10px; } diff --git a/django/contrib/admin/static/admin/css/login.css b/django/contrib/admin/static/admin/css/login.css index 062b36e051..b60be90642 100644 --- a/django/contrib/admin/static/admin/css/login.css +++ b/django/contrib/admin/static/admin/css/login.css @@ -34,10 +34,6 @@ height: auto; } -.login #content-main { - width: 100%; -} - .login .form-row { padding: 4px 0; float: left; @@ -48,9 +44,7 @@ .login .form-row label { padding-right: 0.5em; line-height: 2em; - font-size: 1em; clear: both; - color: #333; } .login .form-row #id_username, .login .form-row #id_password { @@ -60,11 +54,6 @@ box-sizing: border-box; } -.login span.help { - font-size: 10px; - display: block; -} - .login .submit-row { clear: both; padding: 1em 0 0 9.4em; diff --git a/django/contrib/admin/static/admin/css/responsive.css b/django/contrib/admin/static/admin/css/responsive.css index e1ce9c27d1..642640d2e5 100644 --- a/django/contrib/admin/static/admin/css/responsive.css +++ b/django/contrib/admin/static/admin/css/responsive.css @@ -907,7 +907,7 @@ input[type="submit"], button { padding: 15px 0 0; } - .login br, .login .submit-row label { + .login br { display: none; } diff --git a/django/contrib/admin/static/admin/css/rtl.css b/django/contrib/admin/static/admin/css/rtl.css index f4916d3282..a4dae47d47 100644 --- a/django/contrib/admin/static/admin/css/rtl.css +++ b/django/contrib/admin/static/admin/css/rtl.css @@ -1,7 +1,3 @@ -body { - direction: rtl; -} - /* LOGIN */ .login .form-row { diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 5fe6919ea8..a3a60ba181 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -4822,6 +4822,23 @@ class SeleniumTests(AdminSeleniumTestCase): value = self.selenium.find_element_by_id('id_form-0-parent').get_attribute('value') self.assertEqual(value, str(parent2.pk)) + def test_input_element_font(self): + """ + Browsers' default stylesheets override the font of inputs. The admin + adds additional CSS to handle this. + """ + self.selenium.get(self.live_server_url + reverse('admin:login')) + element = self.selenium.find_element_by_id('id_username') + # Some browsers quotes the fonts, some don't. + fonts = [ + font.strip().strip('"') + for font in element.value_of_css_property('font-family').split(',') + ] + self.assertEqual( + fonts, + ['Roboto', 'Lucida Grande', 'Verdana', 'Arial', 'sans-serif'], + ) + @override_settings(ROOT_URLCONF='admin_views.urls') class ReadonlyTest(AdminFieldExtractionMixin, TestCase): |
