blob: 65e49dde312ac3ab4c56a246c4afba150310c899 [file] [log] [blame]
Pankaj Berdec4ae4b82013-01-12 09:56:47 -08001/*
2 Copyright 2012 IBM
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17window.HeaderView = Backbone.View.extend({
18
19 initialize:function () {
20 this.template = _.template(tpl.get('header'));
21 // this.searchResults = new HostCollection();
22 // this.searchresultsView = new SearchListView({model:this.searchResults, className:'dropdown-menu'});
23 },
24
25 render:function (eventName) {
26 $(this.el).html(this.template());
27 $('#live-updates', this.el).change(function () {
28 updating = $(this).is(':checked');
29 })
30 // $('.navbar-search', this.el).append(this.searchresultsView.render().el);
31 return this;
32 },
33
34 events:{
35 "keyup .search-query":"search"
36 },
37
38 search:function (event) {
39// var key = event.target.value;
40 var key = $('#searchText').val();
41 console.log('search ' + key);
42 // TODO search the host and switch lists
43 this.searchResults.findByName(key);
44 setTimeout(function () {
45 $('#searchForm').addClass('open');
46 });
47 }
48
49});