-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Admin-side navbar collapse #3166
Conversation
Got some tests to fix here - capybara is trying to click on nested navbar links, but those are hidden when the navbar is collapsed. The navbar defaults to closed on small screens, which is the problem for these tests. The two solutions I have are to increase capybaras window size, or just click the navbar-toggle button to open the navbar before running the tests. I'll pop something in soon to get the tests to pass. |
Thanks, this looks great! Regarding the specs: My vote is to raise the capybara window size. |
My vote too goes to raise Capybara window size. This looks very good, @seand7565! Thanks a lot 🙌 One small thing: is it possible you could rebase this PR? That'd would help us avoid the merge commit in here |
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 like this feature, just that the commits need some love 😅
(Mostly) passing now! @aitbw The screen size actually wasn't the issue here like I thought, I used the wrong operator in the javascript file determining the default screen size (greater than rather than less than). D'oh! Not sure why the mysql rails 5.1 tests failed - and on the flash too, which wasn't touched in this commit. I'll see if I can find out why it failed! Thanks all for the feedback! ❤️ I rebased and squashed some of the smaller changes - not sure how far you folks like PRs squashed. Should this all be one commit? |
The test that was previously failing here appears to be passing now after a rebase 🤷♂ |
@seand7565 Thanks for the PR 👏 I see it now needs some rebasing, some asset files are out-of-sync, can you please update them? Thank you! |
…for the class to be set on body instantly, rather than having to wait for page load
…till being clickable
This doesn't play well with the new admin styling - will have to make some changes to get it back in line. Give me a few days and I'll have it done! |
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
Outdated
Show resolved
Hide resolved
backend/app/assets/javascripts/spree/backend/components/admin_nav.js
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.
Thanks 🎉
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.
Thanks for carrying this one to the finish line @seand7565! 🏃
if (window.screen.width <= 1024 && !document.cookie.includes("admin_nav_hidden")) { | ||
// Set default nav to collapse on small screens - but don't override user preference | ||
document.body.classList.add("admin-nav-hidden"); | ||
document.cookie = "admin_nav_hidden=true; expires=Fri, 31 Dec 9999 23:59:59 GMT"; |
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.
Any reason not to use LocalStorage instead?
Browser support is pretty wide https://caniuse.com/#feat=namevalue-storage
I would also suggest namespacing the key with solidus.
or solidus/
, e.g. window.localStorage.get('solidus.minimize-admin-nav')
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 believe I was initially using LocalStorage, but there was some feedback on that decision from either @tvdeyen or @seand7565. I do not remember it 🤦♂
I'm ok with this but I think it will need some extra design iterations after the merge. If you agree I'd merge it after v2.9 release which already contains a lot of backend changes. |
Hi @seand7565 and everyone! I tried to improve a little bit more this new feature, moving the collapse icon and leaving the Solidus mark always visible. Then I tried to move to the below the collapse button 👇 Which one do you think that could be the best solution? Note: when you log in with a user whit role of Admin, there is a select for change the language, at the bottom of the sidebar; as you can see by the screenshots above, I choose to hide it when the navbar is collapsed |
That looks fantastic - thanks @mfrecchiami ! I like the button being inside the collapsible panel, so it doesn't affect the layout of the rest of the page. |
Hi @seand7565 ! I did my job starting from your repo 💪 Do you want to do it in a different way? Let me know! |
@mfrecchiami No, that's perfect - thanks! I'll close this PR in favor of yours. |
Description
Makes the admin-side navbar collapsible by clicking a collapse icon at the top of the page.
Additional functionality:
@jacobherrington and @tvdeyen did most of the heavy lifting here, I just cleaned it up and added a few things.
ref #2961 - should close this issue if everything looks good!
Checklist: