Add the ability to toggle display of entire files.
Review Request #11210 — Created Oct. 5, 2020 and updated
The current diff viewer shows the changes for all files and it can be
tedious to scroll through, especially with large changes. Adding the
ability to hide/unhide files will better allow users to look at only
a subset of the changes at once.We added a toggle to the header for each file that collapses the file
to a single line filename. Toggling a collapsed file header will expand
the entire file. This feature is referenced from the toggling of
Reviews
in aReview Request
. When the toggle button is clicked,
jQuerytoggle()
is called on therevision-row
class andtbody
attribute. Thetoggle()
function works toggling the CSSdisplay
property betweendisplay: none
.
Wrote
onToggleCollapseClicked
indiffReviewableViewTests.es6.js
.
Summary | ID |
---|---|
579ed9843edaa7523cf2d7b60fdd8a2f66ac3bbb |
Description | From | Last Updated |
---|---|---|
Hey Kean, can you please add some screenshots of what these toggles look like? |
mike_conley | |
In order to start moving towards our new class naming standards, can we call the state class on the elements … |
david | |
A couple small comments on the look here: Where this same combination is used for reviews, the button is square … |
david | |
I'm confused why this is necessary. Aren't you setting the correct icon class in the HTML template? |
david | |
This blank line can be removed. |
david | |
This can be simplified a bit: const collapsed = this._$filenameRow.hasClass('collapsed'); this._$expandCollpaseButton .toggleClass('rb-icon-expand-review', collapsed) .toggleClass('rb-icon-collapse-review', !collapsed) |
david | |
This blank line can be removed. |
david | |
Let's add a trailing comma to this line. |
david | |
I know it was like this previously, but can you remove the spaces inside {{ file.depot_filename }} so it's consistent … |
david | |
Col: 66 Missing semicolon. |
reviewbot | |
Col: 64 Missing semicolon. |
reviewbot | |
Backbone views have an attribute called this.$el, so you can just use that instead of re-wrapping in jquery. |
david | |
Pretty close. Class name should be -is-collapsed (note the leading hyphen). |
david | |
This blank line can go away. |
david |
- Commits:
-
Summary ID fbeec8382b711654a5822e852463d2ded66be71e fbeec8382b711654a5822e852463d2ded66be71e 763b8a0adde47974a200732bbd1de610abe449c8
Checks run (2 succeeded)
- Description:
-
~ Add toggle button and function for diff files.
~ The current diff viewer shows the changes for all files and it can be
+ tedious to scroll through, especially with large changes. Adding the + ability to hide/unhide files will better allow users to look at only + a subset of the changes at once. + + We added a toggle to the header for each file that collapses the file
+ to a single line filename. Toggling a collapsed file header will expand + the entire file. This feature is referenced from the toggling of + Reviews
in aReview Request
. When the toggle button is clicked,+ jQuery toggle()
is called on therevision-row
class andtbody
+ attribute. The toggle()
function works toggling the CSSdisplay
+ property between display: none
. - Testing Done:
-
+ Wrote
onToggleCollapseClicked
indiffReviewableViewTests.es6.js
.
- Summary:
-
[WIP] Add the ability to toggle display of entire files.Add the ability to toggle display of entire files.
- Commits:
-
Summary ID fbeec8382b711654a5822e852463d2ded66be71e 763b8a0adde47974a200732bbd1de610abe449c8 6f5e66f4461b400bd082cf8fab5592673398e5fd
Checks run (2 succeeded)
- Change Summary:
-
Initialize view for
onToggleCollapseClicked
JS test - Commits:
-
Summary ID 6f5e66f4461b400bd082cf8fab5592673398e5fd 6ae899ab5c45852c6c2fb3bc577a5a0aeb765ec0
Checks run (2 succeeded)
-
-
In order to start moving towards our new class naming standards, can we call the state class on the elements
-is-collapsed
instead ofcollapsed
? -
A couple small comments on the look here:
- Where this same combination is used for reviews, the button is square around the icon. Something is stretching it out a bit here, and I think we should dig into the styles to figure out why and fix it.
- Can we add a little bit of spacing between the button and the filename? The review entry CSS adds
margin-right: 0.5rem
on the.collapse-btn
element.
-
-
-
This can be simplified a bit:
const collapsed = this._$filenameRow.hasClass('collapsed'); this._$expandCollpaseButton .toggleClass('rb-icon-expand-review', collapsed) .toggleClass('rb-icon-collapse-review', !collapsed)
-
-
-
I know it was like this previously, but can you remove the spaces inside
{{ file.depot_filename }}
so it's consistent with the rest of the templates?
- Change Summary:
-
Fix diff4 issues highlighted by David.
- Commits:
-
Summary ID 6ae899ab5c45852c6c2fb3bc577a5a0aeb765ec0 ba72e3e4aa1a7eb71bde37151715329d632a48d7
- Change Summary:
-
Fix JSHint issue.
- Commits:
-
Summary ID ba72e3e4aa1a7eb71bde37151715329d632a48d7 105b2102251d80a4caaff036f39d5692af188bae