-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Expand / Collapse All for "Find In Files" result. #5757
Conversation
Maybe we could make this more visible, when we do it like this users have to remember one more trick. |
@SAplayer we could use a tooltip "Ctrl/Cmd Click to Expand/Collapse all." @sathyamoorthi Ctrl click doesn't work for me. Could it be because I'm on Mac OS X? |
@larz0 yes. That was mac only issue. Could you please try now? |
@sathyamoorthi nice it works now :) Could you add title attribute to the triangle span so we can get a tooltip? This is awesome. |
@larz0 small change. added that. |
@JeffryBooher any chance to pull this in? only simple changes. |
@JeffryBooher PRETTY PLEASE WITH 🍉 ON TOP~ |
|
||
if (searchResults[fullPath].collapsed !== collapsed) { | ||
$(this).nextUntil(".file-section").toggle(); | ||
$(this).find(".disclosure-triangle").toggleClass("expanded").toggleClass("collapsed"); |
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.
These 2 lines are almost the sames as lines (454-455), only the element changes. So I was thinking that maybe we could have a function: _collapseFileResults($row, collapse: boolean)
that could collapse, or uncollapse the results depending on the boolean parameter. Not sure if we should also change the collapse value of the results object in this function.
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.
Yes, it should change the internal state too, so the function can be _collapseFileResults($row, collapse, fullPath)
.
I totally forgot about this PR. I guess I just did a full code review. Haven't tested it yet since is quite behind master. Could you merge it with master too? I guess I could revive this PR if @sathyamoorthi is not available. |
Thanks @TomMalbran! |
@TomMalbran if you wish, please take this forward. I can't get into this for next 2 to 3 days. |
You can do it (I was going to do it if I got no response in like a week or 2). We still need to wait for Sprint 36 to end, and we will have like 3 more weeks until Sprint 37 when this could be released, so we have plenty of time. |
@TomMalbran Cool. Let me fix this and get back to you in few days. Thanks. |
Define self to prevent exception
@JeffryBooher If you are busy with other stuff I can take this PR. |
…kets into Find-In-Files Conflicts: src/search/FindInFiles.js
@TomMalbran Please do another review. |
@@ -417,7 +417,8 @@ define(function (require, exports, module) { | |||
// Insert the search results | |||
$searchContent | |||
.empty() | |||
.append(Mustache.render(searchResultsTemplate, {searchList: searchList})) | |||
.append(Mustache.render(searchResultsTemplate, {searchList: searchList, | |||
triangleTitle: Strings.FIND_IN_FILES_EXPAND_COLLAPSE})) |
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.
We usually just add the Strings
as a key/value of the object and use {{Strings.FIND_IN_FILES_EXPAND_COLLAPSE}}
inside the template. In that way we don't need to add more strings and we can know what is a string in the template.
Minor Nit: Could you also add enter after {
and before }
and align the values?
@sathyamoorthi Second pass done. I like how you used the same code to do both collapse actions. I just added 2 nit comments. It looks like the commits got messed up? There are a few repeated and one from dangoor. |
@TomMalbran I corrected your mentioned nits. _It looks like the commits got messed up? There are a few repeated and one from dangoor._ When I do big merge (2 months data) from upstream, i think github got confused sometimes. But i'm not sure about this either. But this PR should not have any issue, while you pull it in. |
@sathyamoorthi The code looks great and works. One other question (maybe to @LarZ too). Should we try to keep the scroll at the title (file) you click when you uncollapse? Maybe you are doing some sort of rebase? I never got this issue by just doing a fetch and then a merge. Anyway, before merging, do you think you could do a rebase? There are lots of commits and most aren't needed. |
_One other question (maybe to @LarZ too). Should we try to keep the scroll at the title (file) you click when you uncollapse?_ Hmmm. I'm not sure. Let we here it from @LarZ too. Because, when user's intention is to see that one file, they will do regular click. Not ctrl + click. I will say this is good to have feature. But not mandatory. Let we here it from @larz0 (Because he is the other guy interested in this PR) And i would like to coin the other feature that i think, would be very useful. How about sorting search results based on file names? _Maybe you are doing some sort of rebase? I never got this issue by just doing a fetch and then a merge. Anyway, before merging, do you think you could do a rebase? There are lots of commits and most aren't needed._ yes i did rebase to my master. I think, something i'm doing wrong while merging upstream->master->branch. If you feel this is an issue to accept this PR, let me close this PR and create new clear PR. |
1 similar comment
_One other question (maybe to @LarZ too). Should we try to keep the scroll at the title (file) you click when you uncollapse?_ Hmmm. I'm not sure. Let we here it from @LarZ too. Because, when user's intention is to see that one file, they will do regular click. Not ctrl + click. I will say this is good to have feature. But not mandatory. Let we here it from @larz0 (Because he is the other guy interested in this PR) And i would like to coin the other feature that i think, would be very useful. How about sorting search results based on file names? _Maybe you are doing some sort of rebase? I never got this issue by just doing a fetch and then a merge. Anyway, before merging, do you think you could do a rebase? There are lots of commits and most aren't needed._ yes i did rebase to my master. I think, something i'm doing wrong while merging upstream->master->branch. If you feel this is an issue to accept this PR, let me close this PR and create new clear PR. |
I won't be able to test it out since I'm on vacation til Feb 7. Let's see what it's like first without adding any extra stuff and then we can decide later if it's needed. |
@larz0 Cool. Agree. Enjoy your vacation... @TomMalbran Let we wrap this PR here. And if you wish i'll work on additional features and give PR later. Can you merge this PR or do you need me to open separate PR in order to avoid more commits? |
It does makes sense that if you want to see one file you just open that one, and the scroll will not be an issue. If it becomes an issue, it can be fixed later. Rebasing is a hard thing to manage and it not always ends up ok. I guess it will not be a problem merging it like this, but if you can rebase it into 1 commit, I think that will be better. |
Another option for making a "cleaner" PR would be to just generate a .patch file for the original branch, make a new clean branch off of master, and then apply the .patch file there. There's a tutorial on creating & applying .patches here, for example: http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/ |
Even easier would be to just create a new branch off master, and then |
Thanks for the info. Should I do it or @sathyamoorthi? BTW, at which point do we request for a rebase? |
@TomMalbran fixing this PR is taking me long time. So here is new clean PR #6640. Please use that and close this. |
Based on this Google groups discussion
CC: @larz0, @njx, @TomMalbran