-
Notifications
You must be signed in to change notification settings - Fork 0
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
Clear searches #202
Clear searches #202
Conversation
77584df
to
0392d70
Compare
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.
Two minor things but looks good otherwise.
e.preventDefault() | ||
text = $(e.target).val() | ||
templateInstance.userSearchText.set(text) | ||
# 'input .map-search': _.debounce (e, templateInstance) -> |
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.
Should we just yank the commented out code below?
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.
yep, my bad
|
||
Template.searchInput.onCreated -> | ||
instanceData = @data | ||
searching = true |
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.
could these lines be changed to: searching = not instanceData.toggelable
?
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.
I think that would work if we always pass the toggelable property.
Maybe searching = not instanceData.toggelable?
would work? But may be confusing.
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.
searching = not instanceData.toggelable?
works in all cases except for when toggleable is set to false. So maybe this:
toggleable = instanceData.toggleable
toggleable ?= false
@searching = new ReactiveVar(not toggleable)
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.
hrrm - yeah I didn't think of that case. I'd probably just leave it the way it is then.
0392d70
to
5ebf045
Compare
5ebf045
to
c3b0660
Compare
looks good 👍 |
I went ahead and created a single template for all the search inputs. I figured it would reduce a fair amount of repetition with clearing inputs and force us into a consistent search UI/UX.
The template receives an object with options including:
textFilter
: either areactiveVar
orReactiveTableFilter
id
the id associated with the element andReactiveTableFilter
if its passedprops
if aReactiveTableFilter
is not passed, one will be created with theid
andprops
which is an arraytoggleable
If set to true, the input will be initially hidden and appear when the search icon is clicked. When the user clicks on the search icon within the input, the input returns to its hidden state.placeholder
defaults to 'Search'classes
classes which will be applied to the input's parent element