forked from maccman/holla
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearches.js
More file actions
42 lines (33 loc) · 865 Bytes
/
Copy pathsearches.js
File metadata and controls
42 lines (33 loc) · 865 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(function($){
window.Searches = Spine.Controller.create({
elements: {
".items": "items",
".query": "queryEl"
},
events: {
"click .item": "click"
},
proxied: ["render", "query", "checkActive"],
template: function(data){
return $("#searchTemplate").tmpl(data);
},
init: function(){
this.input = $("#sidebar input[type=search]");
this.input.keyup(this.query);
this.model = Search.init();
this.model.bind("change", this.render);
},
render: function(){
this.items.html(this.template(this.model.results));
},
query: function(){
this.model.query(this.input.val());
this.queryEl.text(this.input.val())
this.active();
},
click: function(e){
var item = $(e.target).item().record.reload();
this.App.trigger("change", "channels", item.channel());
}
});
})(jQuery);