티스토리 수익 글 보기
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
#34044 — Add the admin app filter on index pages in addition to the navbar #16107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9d1f44b
to
21c2912
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! Thank you for your contribution 💪
As it’s your first contribution be sure to check out the patch review checklist.
If you’re fixing a ticket from Trac make sure to set the “Has patch” flag and include a link to this PR in the ticket!
If you have any design or process questions then you can ask in the Django forum.
Welcome aboard ⛵️!
6d35b08
to
963a2fe
Compare
Refactored the quick app filter in the Django Admin to make it independent from the navbar itself. The goal is to be able add the app filter on the index page as described in ticket #34044.
Added the quick app filter to the Django Admin index pages. Includes index-specific CSS rules to display the app filter next to the title when possible, else display it below the title (responsive).
963a2fe
to
1802ae4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed at the DjangoCon sprint with Thibault and Tom, looks good except for a few comments.
.filterable-apps-table caption { | ||
/* The captions were resized when using a filter. | ||
This ensures that they keep their original width. */ | ||
width: calc(100% – 16px); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use this instead ? I is defining the table width in the sidebar.
#nav-sidebar table {
width: 100%;
}
.admin-index-title h1 { | ||
flex: 2; | ||
margin-bottom: 0; | ||
padding-right: 1em; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use gaps instead of padding here since it is flex ?
} else { | ||
event.target.classList.add('no-results'); | ||
} | ||
sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename the storage to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The index page should not retain the search filter in the localStorage, this is only really useful in the navbar.
|
||
{% block content %} | ||
<div id=”content-main“> | ||
<div id=”content-main“ class=”filterable-apps-table“> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s move this into a parent <div>
in app_list.html
.
for link in self.selenium.find_elements(By.CSS_SELECTOR, "#nav-sidebar a"): | ||
self.assertEqual(link.get_attribute("tabIndex"), "0") | ||
filter_input = self.selenium.find_element(By.CSS_SELECTOR, “#nav-filter”) | ||
filter_input = self.selenium.find_element(By.CSS_SELECTOR, “#app-filter”) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not worth the renaming in case people extended the admin in their project.
@@ -0,0 +1,53 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless empty line
Another option we discussed during the sprints is to simply add the sidebar to every page. I think this is actually the better solution after thinking about it some more. The main issue is on the app pages, there’s still no way to navigate to models for other apps but to go back to the index (or into a changelist view). It’s quite annoying not having full navigation there in particular. |
@hoh Do you have time to keep working on this? |
Closing due to inactivity. |
So, still no search bar at index page. It will be in next releases ? |
Ticket: https://code.djangoproject.com/ticket/34044
This Pull Request contains two commits:
Screenshots