fix userSearch bindings

This commit is contained in:
Felix Niklas 2014-09-29 10:42:52 +02:00
parent 3f05854c9c
commit 208608472d
3 changed files with 10 additions and 4 deletions

View file

@ -1,4 +1,6 @@
class Index extends App.Controller class Index extends App.Controller
elements:
'.js-search' : 'searchInput'
events: events:
'click [data-type="new"]': 'new' 'click [data-type="new"]': 'new'
@ -24,14 +26,14 @@ class Index extends App.Controller
(e) => (e) =>
e.preventDefault() e.preventDefault()
$(e.target).toggleClass('active') $(e.target).toggleClass('active')
term = @$('.search').val().trim() term = @searchInput.val().trim()
return if !term return if !term
@delay( @search, 220, 'search' ) @delay( @search, 220, 'search' )
) )
# start search # start search
@$('.search').bind( 'keyup', (e) => @searchInput.bind( 'keyup', (e) =>
term = @$('.search').val().trim() term = @searchInput.val().trim()
return if !term return if !term
return if term is @term return if term is @term
@term = term @term = term

View file

@ -12,7 +12,7 @@
</div> </div>
<div class="userSearch horizontal center"> <div class="userSearch horizontal center">
<input type="text" class="flex" name="search" placeholder="<%- @T('Search for users') %>"> <input type="text" class="js-search flex" name="search" placeholder="<%- @T('Search for users') %>">
<div class="userSearch-label"><%- @T('Filter') %>:</div> <div class="userSearch-label"><%- @T('Filter') %>:</div>
<div class="tabs tabs-wide horizontal"> <div class="tabs tabs-wide horizontal">
<% for role in @roles: %> <% for role in @roles: %>

View file

@ -3457,6 +3457,10 @@ footer {
color: #999; color: #999;
} }
.userSearch {
margin-bottom: 20px;
}
.userSearch-label { .userSearch-label {
margin: 0 10px 0 20px; margin: 0 10px 0 20px;
} }