-
-
Notifications
You must be signed in to change notification settings - Fork 193
Tabbed changeform #211
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
Tabbed changeform #211
Conversation
for more information, see https://pre-commit.ci
Codecov ReportBase: 95.58% // Head: 95.70% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #211 +/- ##
==========================================
+ Coverage 95.58% 95.70% +0.11%
==========================================
Files 36 37 +1
Lines 408 419 +11
==========================================
+ Hits 390 401 +11
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@VaZark thank you for this PR, I will test and review it as soon as possible.
I also updated the |
admin_interface/static/admin_interface/css/tabbed-changeform.css
Outdated
Show resolved
Hide resolved
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.
- I think that using the tabs, fieldsets should be always displayed as stacked.
- There is already tabs CSS for
django-modeltranslation
anddjango-tabbed-admin
apps, the tabs style could be based on that:
admin_interface/static/admin_interface/css/tabbed-changeform.css
Outdated
Show resolved
Hide resolved
Regarding tabs, a quick look through the CSS shows that there are assumptions about the structure of the tab. For example in django-admin-interface/admin_interface/static/admin_interface/css/jquery.ui.tabs.css Line 167 in 85fb723
So it assumes the items are hyperlinks within a list. This is not at all in line with my implementation, which is just a bunch of buttons with flex and wrap. I don't there is a way I can reliably reuse them. :( I'll give it shot tho |
Regarding tabs, you can't reuse that CSS, but you can replicate the same design of |
I have not used |
|
||
{% if show_fieldsets_as_tabs %} | ||
{% for fieldset in adminform %} | ||
<button type="button" class="tabbed-changeform-tablinks {{ forloop.counter0|default:"active" }}" onclick="openTab(event, '{{fieldset.name}}')"> |
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.
Is there any appetite for making the tabs work purely with CSS?
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.
Avoiding JavaScript at all for this feature would be great!
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.
I find that using JS is the most readable way to handle the logic.
Most CSS-only solutions I've come across are not easy to implement to be responsive and handle a dynamic no of tabs 😓
You're welcome to change it up though. 👍
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.
Personally I have not any experience with CSS only tabs, I can't evaluate implementation complexity.
Cool the tabs style, I would just make the border of a neutral color (medium grey). |
Used the |
Does the horizontal scroll already work? |
Yup. |
Could you update the translations files? python -m django makemessages --all --add-location=file
python -m django compilemessages --ignore ".tox" --ignore ".venv" --ignore "build" --ignore "venv" |
Thanks for updating the translations :) |
@VaZark I finally tested this feature in a real project and I noticed that there are some issues to fix and some improvements needed before releasing it:
I tested it with Chrome and Firefox. |
Thanks. I’ll take a look tmrw |
One difference between collapsed fieldsets and tabbed fieldsets is that it’s not possible anymore to go to the next section using Tab. Could we add |
@VaZark can you handle the |
if i'm reading this right, the goal is to open and move to the next tab instead of the save/submit section when we are the end of a fieldset on clicking the "tab" button? It currently does not work as the tabs are hidden with However, if the goal is to just switch section from tab header using "tab" button, it still works. we just need to add a visual cue |
I didn’t meant the sections, which are hidden as you say, but the tabs themselves, the little rectangles with labels which are javascript links. |
If this is what is expected, I can send in the PR in a sec Screencast.from.2022-12-09.10-16-37.webm |
Does this mean:
I think it would be good then, although I’m unsure if it’s best to go through tabs then form controls, or form controls then tabs. |
Conventional fieldsets are just dividers that contain text in a continuous form, tabs are closer to sub-pages. Even github scrolls through the tab headers before stepping into the tab content. Jumping back to the top of the page when tabbing through is not a nice experience. |
Sorry, could you reply yes/no to my two points so that I understand the behaviour? |
It’s yes and yes :) |
Related to #209
These are purely visual changes based on a boolean field.
Significant changes are,
show_fieldsets_as_tabs
&show_inlines_as_tabs
and it's migration.headless_*
version of fieldsets and inlines templates in order to hide the header. They are exact copies except for the title line.headerless_*
version of fieldset and inlines when in tabbed mode