티스토리 수익 글 보기

티스토리 수익 글 보기

#34044 — Add the admin app filter on index pages in addition to the navbar by hoh · Pull Request #16107 · django/django · GitHub
Skip to content

Conversation

hoh
Copy link

@hoh hoh commented Sep 24, 2022

Ticket: https://code.djangoproject.com/ticket/34044

This Pull Request contains two commits:

  • The first refactors the admin quick search to make it independent from the navbar itself
  • The second enables the quick search on index pages as well, in order to fix ticket 34044

Screenshots

image
image
image
image
image
image
image

@hoh hoh force-pushed the hoh-apps-quick-search branch 2 times, most recently from 9d1f44b to 21c2912 Compare September 24, 2022 15:58
Copy link

@github-actions github-actions bot left a 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 ⛵️!

@knyghty knyghty requested a review from a team September 24, 2022 16:07
@hoh hoh force-pushed the hoh-apps-quick-search branch 3 times, most recently from 6d35b08 to 963a2fe Compare September 25, 2022 11:03
hoh added 2 commits September 25, 2022 12:10
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).
@hoh hoh force-pushed the hoh-apps-quick-search branch from 963a2fe to 1802ae4 Compare September 25, 2022 11:14
Copy link
Author

@hoh hoh left a 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);
Copy link
Author

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;
Copy link
Author

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);
Copy link
Author

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.

Copy link
Author

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>
Copy link
Author

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”)
Copy link
Author

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 @@

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Useless empty line

@knyghty
Copy link
Member

knyghty commented Sep 29, 2022

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.

@felixxm
Copy link
Member

felixxm commented Oct 11, 2022

@hoh Do you have time to keep working on this?

@hoh
Copy link
Author

hoh commented Oct 19, 2022

@hoh Do you have time to keep working on this?

Yes, but only after mid-november.
I am OK with closing and re-opening if that makes managing issues/PRs easier, but the questions raised by @knyghty should not be forgotten.

@felixxm
Copy link
Member

felixxm commented Dec 13, 2022

Closing due to inactivity.

@felixxm felixxm closed this Dec 13, 2022
@DTeltsov
Copy link

DTeltsov commented Nov 30, 2023

So, still no search bar at index page. It will be in next releases ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants