-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathdb_view.coffee
More file actions
27 lines (23 loc) · 758 Bytes
/
db_view.coffee
File metadata and controls
27 lines (23 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# TODO make it server side so filtering can scale
filterCollections = (query, collections) ->
if query
_.filter(collections, (c) ->
(c.name).indexOf(query) > -1
)
else
collections
Template._houston_db_view.helpers
collections: -> Houston._collections.collections
filtered_collections: ->
filterCollections(
Houston._session('search'),
Houston._collections.collections.find().fetch()
)
Template._houston_db_view.events
# trigger meteor session invalidation, definitely a hack
"click #refresh": -> window.location.reload()
'keyup .houston-column-filter': (e) ->
Houston._session 'search', $("#search").val()
Template._houston_db_view.rendered = ->
$("#search").val("")
$(window).unbind('scroll')