Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search/filter users in the share dialog #3417

Merged
merged 14 commits into from
Apr 30, 2015

Conversation

alonsogarciapablo
Copy link
Contributor

Fixes #1923.

Some decisions I made along the way:

  • Organization settings are only visible when not searching.
  • Hitting ESCAPE while being on the search input resets the search.

@viddo, this one is for you. I finally decided to move some stuff into view_model.js since that's the pattern we're following in this case. share_view.js gets, sets, and listens to changes on the search attribute. I will deploy to staging so that you can QA.

setTimeout(function() {
var $searchInput = this.$('.js-search-input');
$searchInput.focus().val($searchInput.val());
}, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Using timeouts are really keen to strange race conditions, what's the reason for using it here?
    Btw, "this" context is actually window, so the full documented is searched instead of just the scope of this view which I assume is what you want either.
  2. Why set the value it already has to itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

  1. I just realized it was broken (because of the this). It wasn't working properly without the timeout. Perhaps a race condition as you said with something on the dialog. I'll make sure it's still required.
  2. Re-setting the value of the input again makes the cursor move to the end.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I still feel I lack information on why both these things are necessary to do in the first place, can you elaborate? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timeout was finally not necessary, so it's gone. Good catch!

Focussing and moving the cursor to the end of the search input let's me keep typing after submitting a search (we're actually re-rendering everything when a search is submitted, and that's the reason why need this).

focus

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to hear! :)
And now I understand what you needed it for. For this kind of cases (inputs involved) I'm generally skeptical about re-rendering the whole view (which includes the input), instead it's a good motivation to extract the listing to a separate view that is re-rendered alone in the event of a search. Not saying you would have to do it if it works now, but more a remark for future stuff. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I only realized about it when I was writing the previous comment. I'll keep it mind for next time! Thanks!

@viddo
Copy link
Contributor

viddo commented Apr 29, 2015

Apart from comments 👌

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@alonsogarciapablo
Copy link
Contributor Author

@viddo, I rewrote the template to reuse .Filter styles.

It doesn't look exactly as the original mockup, but I think it looks 👍

captura de pantalla 2015-04-29 a las 18 36 30

@saleiva what do you think?

@saleiva
Copy link
Contributor

saleiva commented Apr 29, 2015

👍

@saleiva
Copy link
Contributor

saleiva commented Apr 29, 2015

be carerful with the be open my friend text :P
"Select users one by one, or share with the complete organization" would be better :)

@carlostallon awesome copywriting skills

@alonsogarciapablo
Copy link
Contributor Author

Changed it to:

captura de pantalla 2015-04-29 a las 19 00 34

@saleiva
Copy link
Contributor

saleiva commented Apr 29, 2015

🇯🇵

@viddo
Copy link
Contributor

viddo commented Apr 29, 2015

🎏

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

alonsogarciapablo added a commit that referenced this pull request Apr 30, 2015
Search/filter users in the share dialog
@alonsogarciapablo alonsogarciapablo merged commit 8e84b37 into master Apr 30, 2015
@alonsogarciapablo alonsogarciapablo deleted the 1923-search-filter-users branch April 30, 2015 09:48
@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

@Cartofante
Copy link
Collaborator

Frontend tests were OK 👍 (details)

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

Successfully merging this pull request may close these issues.

Possibility to search/filter users to give permissions
4 participants