Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions django/contrib/admin/static/admin/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 1 addition & 13 deletions django/contrib/admin/static/admin/css/responsive.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
14 changes: 5 additions & 9 deletions django/contrib/admin/static/admin/css/responsive_rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 6 additions & 1 deletion django/contrib/admin/static/admin/css/rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Binary file modified docs/intro/_images/admin04t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/intro/_images/admin05t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/intro/_images/admin12t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/intro/_images/admin13t.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/ref/contrib/admin/_images/list_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions tests/admin_views/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
32 changes: 32 additions & 0 deletions tests/admin_views/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
Song,
State,
Story,
Subscriber,
SuperSecretHideout,
SuperVillain,
Telegram,
Expand Down Expand Up @@ -6955,6 +6956,37 @@ def test_list_editable_with_filter(self):
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):
Expand Down