82 _this.selected_bin_item = undefined; |
82 _this.selected_bin_item = undefined; |
83 }); |
83 }); |
84 if (!_opts.search.length) { |
84 if (!_opts.search.length) { |
85 this.$.find(".Rk-Search-Form").detach(); |
85 this.$.find(".Rk-Search-Form").detach(); |
86 } else { |
86 } else { |
87 var _tmpl = Rkns._.template('<option value="<%= name %>"><%= name %></option>'); |
87 var _tmpl = Rkns._.template('<option value="<%= key %>"><%= value.title %></option>'), |
88 this.$.find(".Rk-Search-Select").html( |
88 _select = this.$.find(".Rk-Search-Select"), |
89 Rkns._(_opts.search).map(function(_name) { |
89 _input = this.$.find(".Rk-Search-Input") |
90 return _tmpl({name:_name}); |
90 _form = this.$.find(".Rk-Search-Form"); |
|
91 _select.html( |
|
92 Rkns._(_opts.search).map(function(_value, _key) { |
|
93 return _tmpl({ |
|
94 key: _key, |
|
95 value: _value |
|
96 }); |
91 }).join("") |
97 }).join("") |
92 ); |
98 ).change(function() { |
|
99 _form.submit(); |
|
100 }); |
|
101 _form.submit(function() { |
|
102 if (_input.val()) { |
|
103 var _search = _opts.search[_select.val()]; |
|
104 _this.tabs.push( |
|
105 new _search.bin( |
|
106 _this, |
|
107 Rkns._({ search: _input.val() }).defaults(_search) |
|
108 ) |
|
109 ); |
|
110 } |
|
111 return false; |
|
112 |
|
113 }); |
93 } |
114 } |
94 this.$.find(".Rk-Search-Form").submit(function() { |
115 |
95 _this.tabs.push( |
|
96 new Rkns.Bins[_this.$.find(".Rk-Search-Select").val()]( |
|
97 _this, |
|
98 { |
|
99 search: _this.$.find(".Rk-Search-Input").val() |
|
100 } |
|
101 ) |
|
102 ); |
|
103 return false; |
|
104 }); |
|
105 this.$.find(".Rk-Bins") |
116 this.$.find(".Rk-Bins") |
106 .click(function(_e) { |
117 .click(function(_e) { |
107 if (_e.target.className == "Rk-Bin-Title") { |
118 if (_e.target.className == "Rk-Bin-Title") { |
108 var _mainDiv = Rkns.$(_e.target).siblings(".Rk-Bin-Main"); |
119 var _mainDiv = Rkns.$(_e.target).siblings(".Rk-Bin-Main"); |
109 if (_mainDiv.is(":hidden")) { |
120 if (_mainDiv.is(":hidden")) { |