Display overlapping comment bubbles side by side
Review Request #6970 — Created Feb. 22, 2015 and submitted
This is the second part in improving the diff comment bubbles. Multiple comment bubbles on the same range will end up overlapping, making it hard to click or inspect on the comments below. This change allows the overlapping comment bubbles to spread out side-by-side when the mouse hovers above them.
Ran js tests. Manually testing: - Added multiple overlapping comment bubbles on the same line to check if the bubbles spread out and collapse correctly. - Checked tooltips are all displayed on the right side of the range of comment bubbles. - Checked that clicking the comment bubbles brings up the comment editor.
Description | From | Last Updated |
---|---|---|
This shoud go at the top of the file. |
chipx86 | |
Can you make these constants on the class, and document them? I'm not sure where the numbers are coming from. … |
chipx86 | |
Since this is a jQuery object, it should be $parent. It is just a convention we use. |
brennie | |
We're calling $el.parent() more than once. Best to store the result in a variable and re-use it. |
chipx86 | |
All declared variables must be at the top of the function. |
chipx86 | |
Comparison should be !== |
chipx86 | |
Unnecessary parens (like around the multiplication) can be removed. |
chipx86 | |
Alignment issue with the variable values. Also, this is a bit ahrd to read. How about: var leftMargin = ..., … |
chipx86 | |
You should chain these, so you don't have to wrap bubble more than once. |
chipx86 | |
Same comment about the initial values. Since we're defining these in more than once place, that's all the more reason … |
chipx86 | |
Only one var statemnet per function. Also, like above, we only want to call $el.parent() once. |
chipx86 | |
Likewise, this too should be $parent. |
brennie | |
That key is pretty generic. Let's use a more specific key. Also, the key should be defined as a constant … |
chipx86 | |
Space after >. |
chipx86 | |
Space around >. Same with others. |
chipx86 | |
Are you sure this always does the right thing? Have you tested different zoom levels? |
chipx86 | |
Comma should go before the comment. Space before the comment, and space between the text and the commnt markers. "Pixels" … |
chipx86 | |
The two lines of values for width must align. |
chipx86 | |
Would be cleaner as (commentBubbles.length - index - 1). |
chipx86 | |
You can simplify this by doing: .css('width', width + 'px') |
chipx86 | |
This repeats the same logic as above. This will work better as a utility function. |
chipx86 | |
Blank line between these. |
chipx86 | |
You could probably just pass the result of the setTimeout call inline in here, making this an the above one … |
chipx86 | |
Why this change? |
brennie | |
Can we just use this.$el throught here instead of introducing $el ? |
brennie | |
Same here. |
brennie |
- Groups:
- Change Summary:
-
- Change css selected row color to only affect it's immediate children.
- Change for loop to jquery's each function.
- Commit:
-
8d4741a174cbec9b71952c179f3f0384eb4cfd11198cfab1e1fdcac0bae0b1f6ff1275a4dd6e7d17
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less
-
-
-
Can you make these constants on the class, and document them? I'm not sure where the numbers are coming from.
If these are things that can be calculated (I'm guessing the initialWidth/initialLeft are), then we should calculate them instead.
-
-
-
-
-
Alignment issue with the variable values.
Also, this is a bit ahrd to read. How about:
var leftMargin = ..., width = initialWidth + spreadDistance * (commentBubbles.length - index + 1);
-
-
Same comment about the initial values.
Since we're defining these in more than once place, that's all the more reason to have a single place where we define or calculate them.
-
-
That key is pretty generic. Let's use a more specific key.
Also, the key should be defined as a constant somewhere, and reused.
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less
-
What happens if you mouse in/out very quickly over the bubbles? If it starts acting like an accordion, you may want to look into using HoverIntents (which we already have packaged with RB).
-
-
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less
- Change Summary:
-
Prevent chaining of animation effects when the mouse move in/out of the comment bubble very quickly
- Commit:
-
4acc9ec5ee81b107cdd76a98072ac8727b42ab1b2ee9a5425527f57c162fdcadad39f7ede94eb3b1
-
Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/css/pages/search.less reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/abstractCommentBlockView.js reviewboard/static/rb/css/pages/search.less reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less
- Change Summary:
-
Change
tooltipSides
property inabstractCommentBlockView
back to prioritize left over right since that is the preference for image commenting.
FortextBasedCommentBlockView
, we would want the tooltips to always display on the right side of the comment block, especially when the comment bubbles are spread out to the right. - Commit:
-
cb62356f0457eed6163f74fec5bc99177825585fc2c7538038a9f3b3030bf046fadb45b8605cc2e1
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/views/textBasedCommentBlockView.js reviewboard/static/rb/css/pages/diffviewer.less