[WIP] Added a floating banner to the diff view
Review Request #8746 — Created Feb. 14, 2017 and discarded
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file.I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a
collapsed list of the diff files, showing only the the file that the user is currently
looking at. The user will be able to expand this list to navigate to the other files.Screenshots and demo video: Notion
I have tested the floating banner on the dev server on review requests with multiple
diff files.I have started writing jasmine tests for the floating banner. This is still a WIP.
The banner has been manually tested (including responsiveness) on Chrome, Safari, and
Firefox. Click here to see GIFs of the manual tests (running on diff revision 13).Further testing on other browsers are required.
Description | From | Last Updated |
---|---|---|
I think this would be more readable if this else was on a new line. |
DA DanielPBak | |
Same here. |
DA DanielPBak | |
remove blank line |
RK rkdhatt | |
Alphabetize |
brennie | |
Doc comments begin with /**. |
brennie | |
Doc comments begin with /** in JS |
brennie | |
How about viewType |
brennie | |
This can always run, since it is just a call to bind. It doesn't hurt. Alternatively we can add this … |
brennie | |
Instead of using each, we should do a for loop. That way we can break out after finding the element … |
brennie | |
This isnt a jQuery. To get a jQuery (and use the .show() method i suggested) use this._$items.eq(index). |
brennie | |
you can do $bannerTableRow.show() here. |
brennie | |
This should be a class, not an ID. |
brennie | |
border has a shorthand property as following: border: border-width border-style border-color or you can define border-width as following: border-width: top … |
AN anni_cao | |
Why do you need break at the end of if statement? It will jump out of the loop anyway, right? |
AN anni_cao |
- Description:
-
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file. I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a collapsed list of the diff files, showing only the the file that the user is currently looking at. The user will be able to expand this list to navigate to the other files. ~ This week I improved the banner styling and further developed the diffFileIndexModel.
~ This week I improved the banner styling and further developed the diffFileIndexModel.
+ See screenshots here: + https://www.notion.so/Week-4-Feb-15th-5974361d443744ed9242030cc19908c1 + I have also written about this week's accomplishments under "Week 4" here: + https://www.notion.so/Task-List-Project-Floating-Banner-a03043d62abf4b4b840a8bed4afb78a4
- Description:
-
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file. I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a collapsed list of the diff files, showing only the the file that the user is currently looking at. The user will be able to expand this list to navigate to the other files. ~ This week I improved the banner styling and further developed the diffFileIndexModel.
~ See screenshots here: ~ https://www.notion.so/Week-4-Feb-15th-5974361d443744ed9242030cc19908c1 ~ This week I improved the banner styling and the
diffFileIndexModel
.~ See screenshots of the updated floating banner on this notion page. ~ See this week's accomplishments under "Week 4" on this notion page. - I have also written about this week's accomplishments under "Week 4" here: - https://www.notion.so/Task-List-Project-Floating-Banner-a03043d62abf4b4b840a8bed4afb78a4
- Description:
-
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file. I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a collapsed list of the diff files, showing only the the file that the user is currently looking at. The user will be able to expand this list to navigate to the other files. - - This week I improved the banner styling and the
diffFileIndexModel
.- See screenshots of the updated floating banner on this notion page. - See this week's accomplishments under "Week 4" on this notion page. - Commit:
-
8adb665eedcec9649b2b968f97db937cf3034fba205feefa2d446667c39055ea416e10fa89fa103b
- Diff:
-
Revision 2 (+119 -24)
-
Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
205feefa2d446667c39055ea416e10fa89fa103b7bfd1959ec97f51fd1487b83b59b37ba0b9fe9bf
- Diff:
-
Revision 3 (+131 -24)
-
Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
7bfd1959ec97f51fd1487b83b59b37ba0b9fe9bfefcb06b5c817bcbda1e3d2b5e7b36d3d203a1d5b
- Diff:
-
Revision 4 (+135 -24)
-
Tool: PEP8 Style Checker Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: Pyflakes Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
efcb06b5c817bcbda1e3d2b5e7b36d3d203a1d5bd075936ae331ebcb62bc3a28b2a9ac966c44af4f
- Diff:
-
Revision 5 (+140 -25)
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Testing Done:
-
~ I have tested the floating banner on the dev server on review requests with only 1
~ diff file. Further testing must be done on review requests with multiple diff files. ~ I have tested the floating banner on the dev server on review requests with multiple
~ diff files. - Commit:
-
d075936ae331ebcb62bc3a28b2a9ac966c44af4f10c8927cace2c41148adff561891e715499a1ed4
- Diff:
-
Revision 6 (+139 -25)
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
~ diff files. ~ diff files. + So far I have only tested on Chrome. Further testing on other browsers must be done. - Commit:
-
10c8927cace2c41148adff561891e715499a1ed4bcdd6cd69ee200a266311d722de714b28dff35cb
- Diff:
-
Revision 7 (+188 -25)
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
bcdd6cd69ee200a266311d722de714b28dff35cb0e46b8dd54a00631ce3ccafce7ffe38f63447185
- Diff:
-
Revision 8 (+184 -25)
-
Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
0e46b8dd54a00631ce3ccafce7ffe38f6344718527c783aa0faeac728d5c3123584723f77fb8904f
- Diff:
-
Revision 9 (+192 -25)
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
-
-
-
-
-
-
This can always run, since it is just a call to bind. It doesn't hurt.
Alternatively we can add this specific behaviour in a subclass. (That is what I would prefer here, but you may want to ask another mentor's opinion.)
-
Instead of using
each
, we should do afor
loop. That way we canbreak
out after finding the element to display (because if its the first one of twenty, there is no need to consider the next 19). It also lets us use a more correct way of determing if something is in view:windowBottom = windowTop + $(window).height(); for (i = 0; i < this.collection.size(); i++) { /* variable assignments */ if (filePositionTop <= windowTop && filePositionBottom >= windowTop || filePositionTop >= windowTop && filePositionTop <= windowTop + $(window).height()) { /* in view, show it */ break; } }
The first condition checks if the file is above or starting at the top of the window and the second checks that the top of the file is within the window viewport.
However, you will also have to hide all other elements which you can do with
this._$items.hide()
before the loop. -
This isnt a jQuery. To get a jQuery (and use the
.show()
method i suggested) usethis._$items.eq(index)
. -
- Commit:
-
27c783aa0faeac728d5c3123584723f77fb8904f33f7ba1c9d5754666ddddda597a70ad1eda50615
- Diff:
-
Revision 10 (+266 -75)
-
Tool: PEP8 Style Checker Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js Tool: Pyflakes Processed Files: reviewboard/staticbundles.py Ignored Files: reviewboard/static/rb/js/diffviewer/views/diffFileIndexView.js reviewboard/static/rb/css/pages/diffviewer.less reviewboard/static/rb/js/views/floatingBannerView.js reviewboard/templates/diffviewer/view_diff.html reviewboard/static/rb/js/pages/models/diffViewerPageModel.js reviewboard/static/rb/js/diffviewer/models/diffFileIndexModel.js reviewboard/static/rb/js/diffviewer/views/floatingBannerIndexView.js reviewboard/static/rb/js/pages/views/diffViewerPageView.js
- Commit:
-
33f7ba1c9d5754666ddddda597a70ad1eda5061570ead4405ccaf354b776d798133f143dfb3f39dc
- Diff:
-
Revision 11 (+275 -75)
Checks run (2 succeeded, 1 failed with error)
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
diff files. ~ So far I have only tested on Chrome. Further testing on other browsers must be done. ~ The banner has been tested on Chrome and Safari. Further testing on other browsers + must be done.
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
diff files. ~ The banner has been tested on Chrome and Safari. Further testing on other browsers ~ must be done. ~ The banner has been tested on Chrome, Safari, and Firefox. Further testing on other ~ browsers is required. - Commit:
-
70ead4405ccaf354b776d798133f143dfb3f39dc1a05450f917ad4f2825b012a12dd7be54f75bf73
- Diff:
-
Revision 12 (+274 -66)
Checks run (2 succeeded, 1 failed with error)
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
diff files. ~ The banner has been tested on Chrome, Safari, and Firefox. Further testing on other ~ browsers is required. ~ I have started writing jasmine tests for the floating banner. This is still a WIP. ~ The banner has been manually tested (including responsiveness) on Chrome, Safari, and + Firefox. Further testing on other browsers is required. - Commit:
-
1a05450f917ad4f2825b012a12dd7be54f75bf7335ba459dd8214224801b8526cceb2af4554c31c6
- Diff:
-
Revision 13 (+349 -66)
Checks run (2 succeeded, 1 failed with error)
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
diff files. I have started writing jasmine tests for the floating banner. This is still a WIP. The banner has been manually tested (including responsiveness) on Chrome, Safari, and ~ Firefox. Further testing on other browsers is required. ~ Firefox. Click here to see GIFs of the manual tests. + Further testing on other browsers is required. - Commit:
-
35ba459dd8214224801b8526cceb2af4554c31c6da02f6b64a3321b6403a2addafe34c11cc1c79ab
- Diff:
-
Revision 14 (+493 -66)
Checks run (2 succeeded, 1 failed with error)
- Description:
-
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file. I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a collapsed list of the diff files, showing only the the file that the user is currently looking at. The user will be able to expand this list to navigate to the other files. + + Screenshots: Notion
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
~ diff files. ~ I have started writing jasmine tests for the floating banner. This is still a WIP. ~ diff files. ~ + I have started writing jasmine tests for the floating banner. This is still a WIP.
The banner has been manually tested (including responsiveness) on Chrome, Safari, and ~ Firefox. Click here to see GIFs of the manual tests. ~ Further testing on other browsers is required. ~ Firefox. Click here to see GIFs of the manual tests. ~ + Further testing on other browsers are required.
- Commit:
-
da02f6b64a3321b6403a2addafe34c11cc1c79ab931b0054627330b09baed3093102b7daf724b6d5
- Diff:
-
Revision 15 (+502 -66)
Checks run (2 succeeded, 1 failed with error)
- Commit:
-
931b0054627330b09baed3093102b7daf724b6d553d5c1c073f3fd5e82b955417cea56407b9fda5c
- Diff:
-
Revision 16 (+554 -80)
Checks run (2 succeeded, 1 failed with error)
- Description:
-
We currently have to scroll all the way to the top if we want to be navigated to a
specific diff file. I added a floating banner to the diff view that sticks to the top of the page when
the user has scrolled down on the page. On this banner, I will further add a collapsed list of the diff files, showing only the the file that the user is currently looking at. The user will be able to expand this list to navigate to the other files. ~ Screenshots: Notion
~ Screenshots and demo video: Notion
- Testing Done:
-
I have tested the floating banner on the dev server on review requests with multiple
diff files. I have started writing jasmine tests for the floating banner. This is still a WIP.
The banner has been manually tested (including responsiveness) on Chrome, Safari, and ~ Firefox. Click here to see GIFs of the manual tests. ~ Firefox. Click here to see GIFs of the manual tests (running on diff revision 13). Further testing on other browsers are required.