Responsive UI for main menu and banner
Review Request #6796 — Created Jan. 17, 2015 and submitted
Previously without responsive css/js design, the main menu and banner get cramped up when the screen size is smaller than 720px, which is the case for many mobile screens. This reduces the usability of the website in particularly being hard to browse, navigate, and click on the links.
This change focuses on redesigning the main menu and banner to make it easier to use when the screen estate is limited. Including making main menu slide out and search box expandable, and reduces the amount of information shown on the banner.
//
Changes added
- Adjust element displays on width < 720px (+media tags in base.less)
- Logo icon turn into mobile menu toggler when width <= 720px (+control logic in common.js)
- Translucent masking layer sit between mobile menu and rest of the page, closes the menu when clicked (+div dom in base.html)
- Moved account & support menu into its own template file and included in mobile menu (+navsupportmenu.html)
- Using search icon to display/hide search box in mobile menu to reduce screen estate usage
- moved menu toggle logic into it's own backbone view
- Review board manage.py test
- Firefox & Chrome window resizing to examine the css change
- Menu toggle function working when window size <= 720px, including boundary case 720/721px
- Closing menu by clicking the masking layer
- Resizing window to > 720px after mobile menu opened will leave the translucent mask on with menu hidden, but the state will remain the same when the window is resized back to <=720px or mask clicked
Description | From | Last Updated |
---|---|---|
Can you stretch the menu vertically to fill the entire height of the document? |
david | |
Can we remove the dimming when the window gets larger again? |
david | |
How about scaling down this icon so that the entire header is the height of the search icon? |
david | |
Can we reduce the size of this so that everything is the height of the text / search icon? |
david | |
This would be better in defs.less. However, we probably want to be more specific in the name, because there's a … |
chipx86 | |
Space after the :. Given that we're doing this media query a lot, we should have a macro for it … |
chipx86 | |
Trailing whitespace. Should use .opacity(0.5); |
chipx86 | |
Rather than hard-coding indexes, we should use the pre-defined constants in defs.less. |
chipx86 | |
Space after :. |
chipx86 | |
Should just use 0 instead of 0px. No need for px when dealing with 0. |
chipx86 | |
Space between these. |
chipx86 | |
Any time you're dealing with precise values like these (-160px or the color), you should use constants. Also, don't use … |
chipx86 | |
Should be more like #mobile-account-nav. |
chipx86 | |
Space after :. Go through the rest of these and make sure they're in the right form. |
chipx86 | |
Trailing whitespace. |
chipx86 | |
Check other JavaScript files for the format needed for doc comments. |
chipx86 | |
Space after if. |
chipx86 | |
We should call this base/_nav_support_menu.html |
chipx86 | |
We only use 1-space indentation for HTML. In this case, don't indent the template tag at all. |
chipx86 | |
Only one blank line here. |
chipx86 | |
Only 1-space indentation. |
chipx86 | |
Can we call this search-icon? |
david | |
Spaces around the > chacacters. |
david | |
Space between ) and { |
david | |
Please break this up onto several lines, and prefer single quotes over double. $('#navbar-container').animate({ left: 0 }, function() { $(this).addClass('menu-active'); … |
david | |
These should all be on one line. |
david | |
You've got some trailing whitespace here. Please also add in punctuation and rewrap. |
david | |
Space between ) and { |
david | |
{ on the same line |
david | |
{ should be on the same line as the if, and } else { should all be one line. You … |
david | |
I don't want to overload the term "banner." We already have banners for drafts of reviews and review requests. I'd … |
chipx86 | |
These are indented via tabs, as are some of the other lines (31, 39, 43), should be spaces. :/ |
SU Sunxperous | |
Same tabs and spaces identation issue for this part. |
SU Sunxperous | |
Indentation in LESS files should be 2 spaces. |
david | |
Please add this line back. |
david | |
Can you fix these comments? |
david | |
Wrap to 80 columns (expand out the function to be one line per statement). You've also got some bad indentation … |
david | |
It's really weird to use _.template() this way. |
david | |
No spaces inside (). |
david | |
Indentation is wacky. Please make sure there are no tab characters and everything is done with spaces. |
david | |
Indentation. |
david | |
Indentation. |
david | |
Space after :. Should also be '0px' as a string rather than just an integer. |
david | |
Missing semicolon. |
david | |
Space after :. Should also be '-160px' as a string rather than just an integer. |
david | |
Missing semicolon. |
david | |
No need to assign this to a variable, just do new RB.HeaderView(...); |
david | |
Please undo these changes. |
david | |
I think you could remove the second line of this comment. It doesn't really add anything. |
david | |
Because you pass the element in when creating this view, you don't need to specify it here. |
david | |
Add a space after 'if' |
david | |
Wrap to 80 columns. |
david | |
Single quotes. |
david | |
Single quotes. |
david | |
Single quotes. |
david | |
There should be no changes to common.js in this review request. |
david | |
Remove this blank line. |
david | |
Please add spaces around >. |
david | |
Your changes here seem to have regressed the visual appearance for desktop-size windows. Please go through and make sure that … |
david |
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Testing Done: |
|
-
Hey Jason,
See my comments on /r/6782/ for what I'm looking to see in summaries/descriptions. This is the first impression to any reviwer, and is just as important as code, which is why you'll see me drill it in :)
-
I haven't looked at the code yet, just the screenshots. Ditto on what Christian said about the summary/description.
-
-
-
Description: |
|
---|
-
I left a lot of comments on style, but there's also some higher-level things to go into.
It's good to familiarize yourself with LessCSS and with how we make use of definitions and macros. You'll need to become an expert in this for this work. We'll probably want to find ways to better organize the new work here to make it more understandable as well. Adding comments to describe the changes making in each media block would be very beneficial.
Also, we're moving away from common.js. All new JavaScript should be in the model/view setup we have.
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) This would be better in defs.less. However, we probably want to be more specific in the name, because there's a lot of mobile screen sizes.
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Space after the
:
.Given that we're doing this media query a lot, we should have a macro for it in defs.less.
We actually use a similar thing for the Review Board site, so I'd suggest:
.on-mobile-medium-screen(@rules) { @media screen and (max-width: @medium-screen-width), screen and (max-device-width: @medium-screen-width) and (orientation: landscape) { @rules(); } }
(Not sure if "medium" is right, but whatever.)
This will help us have rules for different screen sizes.
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Trailing whitespace.
Should use
.opacity(0.5);
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Rather than hard-coding indexes, we should use the pre-defined constants in defs.less.
-
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Should just use
0
instead of0px
. No need forpx
when dealing with 0. -
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Any time you're dealing with precise values like these (
-160px
or the color), you should use constants.Also, don't use the long form for the background. You can just specify the color and the rest will go to defaults.
-
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Should be more like
#mobile-account-nav
. -
reviewboard/static/rb/css/pages/base.less (Diff revision 1) Space after
:
.Go through the rest of these and make sure they're in the right form.
-
-
reviewboard/static/rb/js/common.js (Diff revision 1) Check other JavaScript files for the format needed for doc comments.
-
-
reviewboard/templates/base/headerbar.html (Diff revision 1) We should call this
base/_nav_support_menu.html
-
reviewboard/templates/base/navbar.html (Diff revision 1) We only use 1-space indentation for HTML. In this case, don't indent the template tag at all.
-
-
Change Summary:
This change corrected mainly coding style issues raised by Christian and also banner resize / mobile menu close when window is resized as mentioned in David's comment
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+202 -34) |
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html
Summary: |
|
|||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
-
-
-
-
-
reviewboard/static/rb/js/common.js (Diff revision 2) Please break this up onto several lines, and prefer single quotes over double.
$('#navbar-container').animate({ left: 0 }, function() { $(this).addClass('menu-active'); });
Same comment for code below.
-
-
reviewboard/static/rb/js/common.js (Diff revision 2) You've got some trailing whitespace here. Please also add in punctuation and rewrap.
-
-
-
reviewboard/static/rb/js/common.js (Diff revision 2) {
should be on the same line as the if, and} else {
should all be one line.You can also do the
mobileMenuToggle
as one call:$.fn.mobileMenuToggle( $('#navbar-container').hasClass('menu-active')))
All of this should really go into a backbone view for the header rather than adding stuff to common.js
-
Jason, can we prioritize this change? All the others depend on it, and I think it would make sense to get this one finished up before tackling too many other things.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 3 (+287 -35) |
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/bannerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/bannerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html
-
-
reviewboard/static/rb/js/views/bannerView.js (Diff revision 3) These are indented via tabs, as are some of the other lines (31, 39, 43), should be spaces. :/
-
reviewboard/templates/base/headerbar.html (Diff revision 3) Same tabs and spaces identation issue for this part.
-
-
reviewboard/static/rb/js/views/bannerView.js (Diff revision 3) I don't want to overload the term "banner." We already have banners for drafts of reviews and review requests. I'd rather we call this something different. It's pretty confusing now.
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 4 (+221 -36) |
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html
-
-
reviewboard/static/rb/css/pages/base.less (Diff revision 4) Indentation in LESS files should be 2 spaces.
-
-
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 4) Wrap to 80 columns (expand out the function to be one line per statement). You've also got some bad indentation here.
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 4) It's really weird to use
_.template()
this way. -
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 4) Indentation is wacky. Please make sure there are no tab characters and everything is done with spaces.
-
-
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 4) Space after :. Should also be
'0px'
as a string rather than just an integer. -
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 4) Space after :. Should also be
'-160px'
as a string rather than just an integer. -
-
reviewboard/templates/base.html (Diff revision 4) No need to assign this to a variable, just do
new RB.HeaderView(...);
Change Summary:
fixed code styling issue according to David's comment
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+229 -47) |
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html
-
-
-
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 5) I think you could remove the second line of this comment. It doesn't really add anything.
-
reviewboard/static/rb/js/views/headerView.js (Diff revision 5) Because you pass the element in when creating this view, you don't need to specify it here.
-
-
-
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 6 (+227 -47) |
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/css/defs.less reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/js/common.js reviewboard/templates/base/branding.html
-
-
reviewboard/static/rb/js/common.js (Diff revision 6) There should be no changes to common.js in this review request.
-
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 7 (+226 -46) |
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html
-
I just applied the change and did a little testing. Here are some suggestions:
- The overlay mask seems to be left-indented about 0.5em. Please add
left: 0
to its style rules. - The overlay mask overlays on top of the header bar, shading out the menu button. Can you change the mobile
#headerbar
padding to be a pixel value (rather that 0.5em) and then change#mobile-menu-mask
's top to be aligned such that it's below the header? - There doesn't seem to be enough space between the header and the page in mobile mode
- There's an extra <br> element in the #headerbar.
- There's not quite enough padding at the top of the mobile menu.
- The overlay mask seems to be left-indented about 0.5em. Please add
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 8 (+233 -49) |
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html
-
-
reviewboard/static/rb/css/pages/base.less (Diff revisions 7 - 8) Your changes here seem to have regressed the visual appearance for desktop-size windows. Please go through and make sure that things line up and look good in both cases.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 9 (+237 -49) |
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/templates/base/navbar.html reviewboard/templates/base.html reviewboard/templates/base/_nav_support_menu.html reviewboard/templates/base/headerbar.html reviewboard/static/rb/css/pages/base.less reviewboard/static/rb/js/views/headerView.js reviewboard/static/rb/css/defs.less reviewboard/templates/base/branding.html