1
0
mirror of https://github.com/django/django.git synced 2025-08-21 01:09:13 +00:00

Fixed #36055 -- Prevented overlap of object-tools buttons and page header in the admin.

This commit is contained in:
antoliny0919 2025-07-24 19:15:32 +09:00 committed by Sarah Boyce
parent f96c8f07e4
commit 94c2f3b993
13 changed files with 60 additions and 33 deletions

View File

@ -808,19 +808,19 @@ a.deletelink:focus, a.deletelink:hover {
/* OBJECT TOOLS */
.object-tools {
font-size: 0.625rem;
font-weight: bold;
padding-left: 0;
float: right;
position: relative;
margin-top: -48px;
padding: 0;
overflow: hidden;
text-align: right;
margin: 0 0 15px;
}
.object-tools li {
display: block;
float: left;
margin-left: 5px;
height: 1rem;
display: inline-block;
height: auto;
}
.object-tools li + li {
margin-left: 15px;
}
.object-tools a {

View File

@ -442,19 +442,7 @@ input[type="submit"], button {
}
.object-tools {
float: none;
margin: 0 0 15px;
padding: 0;
overflow: hidden;
}
.object-tools li {
height: auto;
margin-left: 0;
}
.object-tools li + li {
margin-left: 15px;
text-align: left;
}
/* Forms */

View File

@ -34,15 +34,6 @@
background-position: calc(100% - 8px) 9px;
}
[dir="rtl"] .object-tools li {
float: right;
}
[dir="rtl"] .object-tools li + li {
margin-left: 0;
margin-right: 15px;
}
[dir="rtl"] .dashboard .module table td a {
padding-left: 0;
padding-right: 16px;
@ -72,6 +63,11 @@
margin-left: 0;
margin-right: 0;
}
[dir="rtl"] .object-tools {
text-align: right;
}
[dir="rtl"] .aligned .vCheckboxLabel {
padding: 1px 5px 0 0;
}

View File

@ -26,7 +26,12 @@ th {
}
.object-tools {
float: left;
text-align: left;
}
.object-tools li + li {
margin-right: 15px;
margin-left: 0;
}
thead th:first-child,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -973,6 +973,12 @@ class Restaurant(models.Model):
city = models.ForeignKey(City, models.CASCADE)
name = models.CharField(max_length=100)
class Meta:
verbose_name = (
"very very very very very very very very very "
"loooooooooooooooooooooooooooooooooooooooooong name"
)
def get_absolute_url(self):
return "/dummy/%s/" % self.pk

View File

@ -126,6 +126,7 @@ from .models import (
Song,
State,
Story,
Subscriber,
SuperSecretHideout,
SuperVillain,
Telegram,
@ -6955,6 +6956,37 @@ class SeleniumTests(AdminSeleniumTestCase):
with self.wait_page_loaded():
save_button.click()
@screenshot_cases(["desktop_size", "mobile_size", "rtl", "dark", "high_contrast"])
def test_long_header_with_object_tools_layout(self):
from selenium.webdriver.common.by import By
self.admin_login(
username="super", password="secret", login_url=reverse("admin:index")
)
s = Subscriber.objects.create(name="a " * 40, email="b " * 80)
self.selenium.get(
self.live_server_url
+ reverse("admin:admin_views_subscriber_change", args=(s.pk,))
)
header = self.selenium.find_element(By.CSS_SELECTOR, "div#content h2")
self.assertGreater(len(header.text), 100)
object_tools = self.selenium.find_elements(
By.CSS_SELECTOR, "div#content ul.object-tools li"
)
self.assertGreater(len(object_tools), 0)
self.take_screenshot("change_form")
self.selenium.get(
self.live_server_url + reverse("admin:admin_views_restaurant_changelist")
)
header = self.selenium.find_element(By.CSS_SELECTOR, "div#content h1")
self.assertGreater(len(header.text), 100)
object_tools = self.selenium.find_elements(
By.CSS_SELECTOR, "div#content ul.object-tools li"
)
self.assertGreater(len(object_tools), 0)
self.take_screenshot("change_list")
@override_settings(ROOT_URLCONF="admin_views.urls")
class ReadonlyTest(AdminFieldExtractionMixin, TestCase):