Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Expand / Collapse All for "Find In Files" result. #5757

Closed
wants to merge 14 commits into from
Closed

Expand / Collapse All for "Find In Files" result. #5757

wants to merge 14 commits into from

Conversation

sathyamoorthi
Copy link
Contributor

@marcelgerber
Copy link
Contributor

Maybe we could make this more visible, when we do it like this users have to remember one more trick.

@larz0
Copy link
Member

larz0 commented Oct 30, 2013

@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?

@sathyamoorthi
Copy link
Contributor Author

@larz0 yes. That was mac only issue. Could you please try now?

@larz0
Copy link
Member

larz0 commented Oct 31, 2013

@sathyamoorthi nice it works now :) Could you add title attribute to the triangle span so we can get a tooltip? This is awesome.

screen shot 2013-10-31 at 12 23 38 pm

@sathyamoorthi
Copy link
Contributor Author

@larz0 small change. added that.

@ghost ghost assigned JeffryBooher Nov 1, 2013
@sathyamoorthi
Copy link
Contributor Author

@JeffryBooher any chance to pull this in? only simple changes.

@larz0
Copy link
Member

larz0 commented Jan 19, 2014

@JeffryBooher PRETTY PLEASE WITH 🍉 ON TOP~


if (searchResults[fullPath].collapsed !== collapsed) {
$(this).nextUntil(".file-section").toggle();
$(this).find(".disclosure-triangle").toggleClass("expanded").toggleClass("collapsed");
Copy link
Contributor

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.

Copy link
Contributor

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).

@TomMalbran
Copy link
Contributor

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.

@larz0
Copy link
Member

larz0 commented Jan 19, 2014

Thanks @TomMalbran!

@sathyamoorthi
Copy link
Contributor Author

@TomMalbran if you wish, please take this forward. I can't get into this for next 2 to 3 days.

@TomMalbran
Copy link
Contributor

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.

@sathyamoorthi
Copy link
Contributor Author

@TomMalbran Cool. Let me fix this and get back to you in few days. Thanks.

Define self to prevent exception
@TomMalbran
Copy link
Contributor

@JeffryBooher If you are busy with other stuff I can take this PR.

@sathyamoorthi
Copy link
Contributor Author

@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}))
Copy link
Contributor

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?

@TomMalbran
Copy link
Contributor

@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.

@sathyamoorthi
Copy link
Contributor Author

@TomMalbran I corrected your mentioned nits.

_It looks like the commits got messed up? There are a few repeated and one from dangoor._
I faced these kind of issues in my other PR as well (#5866, #5951).

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.

@TomMalbran
Copy link
Contributor

@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.

@sathyamoorthi
Copy link
Contributor Author

_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
@sathyamoorthi
Copy link
Contributor Author

_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.

@larz0
Copy link
Member

larz0 commented Jan 24, 2014

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.

@sathyamoorthi
Copy link
Contributor Author

@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?

@TomMalbran
Copy link
Contributor

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.

@peterflynn
Copy link
Member

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/

@njx
Copy link

njx commented Jan 25, 2014

Even easier would be to just create a new branch off master, and then git merge --squash thisbranch, then git commit. That will give you a single commit with all the changes from this branch.

@TomMalbran
Copy link
Contributor

Thanks for the info. Should I do it or @sathyamoorthi?

BTW, at which point do we request for a rebase?

@sathyamoorthi
Copy link
Contributor Author

@TomMalbran fixing this PR is taking me long time. So here is new clean PR #6640. Please use that and close this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants