-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Collapsible filters in admin listings #252
Comments
@morlandi cool suggestion! |
This is similar to what I have suggested in #163! |
@smunoz-ml true, even if at UI level, having the filter collapsible to the right seems to be more complicated than having it in an absolute position above the changelist. |
I do agree on this point, partly because the django-grappelli solution is familiar to me and therefore I'm used to it, but above all because having the filters under your nose (even when collapsed they act as a placeholder), is more intuitive compared to an anonymous button. |
Whatever is easier for you @fabiocaccamo or whomever is going to implement this feature. I suggested the solution of collapsing to the right like the left menu because the left menu is already implemented and I thought that the implementation of the same feature on the right side would be easier. But @morlandi's solution also works for me! |
Sidebar collapsing would look better and be more usable than the button style in the screenshot! |
The real challenge here is to implement this without interfering too much with Django admin templates .. so the solution can survive across future Django releases ;) I am available to collaborate in the implementation perhaps with some strategic suggestions from the author @fabiocaccamo , or at the very least to test a temporary solution during development |
@morlandi if you want to work on a PR for this, I will be glad to discuss it together. I would opt for the "Grappelli" solution, it seems to me the better at UX level and also easier to develop/maintain in the long term. |
Some time ago I did some tests, I paste what I did here, so I can delete the file from my desktop :) /* solution 1 */
.admin-interface .module.filtered #changelist-filter {
position: fixed;
z-index: 50;
box-shadow: 0px 4px 16px rgba(0,0,0,0.2);
bottom: 40px;
right: 40px;
top: auto;
max-width: 240px;
margin: 0;
padding: 0;
max-height: calc(100% - 115px);
}
.admin-interface .module.filtered #changelist-filter > h2 {
position: sticky;
top: 0;
z-index: 10;
border: 1px solid rgba(255,255,255,0.3);
border-bottom: none;
cursor: pointer;
}
/* collapsed */
.admin-interface .module.filtered #changelist-filter {
height: 35px;
overflow: hidden;
}
/* solution 2 */
.admin-interface .module.filtered #changelist-filter {
margin-left: -240px;
height: 34px;
overflow: hidden;
cursor: pointer;
margin-top: 5px;
box-shadow: 4px 4px 16px rgba(0,0,0,0.6);
} |
@fabiocaccamo Thanks for your suggestions. I've used them in the following override of the
The toggling script needs to be put in the footer block to ensure it is included at the very end of the HTML code, so that the filter container element is defined when the initialization JS code is executed. It seems to work fine in Django 5.x, even with |
Extended @EricPobot's solution with a chevron to make it more intuitive to the user that the feature is there:
Verified on Django==5.1.2 with django-admin-interface==0.28.9. |
@bastiaan85 Thanks a lot for this very valuable improvement. I'm going to integrate it ASAP in my projects. |
Sometime you need to display many columns in the listing,
and the horizontal space taken up by the filters results in additional horizontal scrolling which might be inconvenient.
In these situations, the possibility to (optionally) collapse the filters could help; mush like django-grappelli does:
The text was updated successfully, but these errors were encountered: