-
-
Notifications
You must be signed in to change notification settings - Fork 188
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
Add fieldsets collapsed default value option. #173
Comments
I am using the collapse class provided by django in one admin class of one project, with a custom script to expand the fieldset as initial state (in other words, I need the fieldsets collapsible, not collapsed). I add a class Recently the custom script stopped working, so after fighting a bit with DOM event collapsing and bubbling (ugh) I decided to copy django’s collapse.js to my project and change the behaviour directly. (This would also avoid the visual issue of fieldset being visible, then django’s script loads and collapses them, then my script expands them — now it will just add the buttons.) So, what if django-admin-interface copied static/admin/js/collapse.js from django to override it? |
That would be great, and since there is JS involved for doing this I would add also: 👉 Storing locally each fieldset state (per model class), the cache key could be f"{app_name}-{model_name}-{fieldset_name}". #160 Could you work on this feature? |
I’ll make a PR with the django script modified. I will look at per-user state persistence in a separate commit. Is there an easy way to get the theme option from JS? Output it as a |
I don't think we need a per-user state persistence, I would store them using local storage (already did a similar thing for foldable apps feature). Exposing theme options as JS variables could be good and useful thing. |
I meant that local storage is per-browser persistence, not adding a model with foreign key to user! |
I found the current technique in a template:
Easy to use the same. |
True, but how often different users will use the same backend with the same computer/browser?
Yes, body classes are perfect for features on/off, no need to expose variables. |
I don’t understand this sub-part of the discussion! You requested to persist current collapsed state in local storage. I said I don’t need that for my project but will add it. |
Ahh ok, now I understand, sorry. |
Released |
Ideas:
settings
.Theme
options.The text was updated successfully, but these errors were encountered: