porthos 3.0.0.beta1 → 3.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Porthos
2
- VERSION = "3.0.0.beta1"
2
+ VERSION = "3.0.0.beta2"
3
3
  end
@@ -0,0 +1,340 @@
1
+ /* @group Base */
2
+ select.chzn-select {
3
+ visibility: hidden;
4
+ height: 28px !important;
5
+ min-height: 28px !important;
6
+ }
7
+ .chzn-container {
8
+ font-size: 13px;
9
+ position: relative;
10
+ display: inline-block;
11
+ zoom: 1;
12
+ *display: inline;
13
+ }
14
+ .chzn-container .chzn-drop {
15
+ background: #fff;
16
+ border: 1px solid #aaa;
17
+ border-top: 0;
18
+ position: absolute;
19
+ top: 29px;
20
+ left: 0;
21
+ -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
22
+ -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
23
+ -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
24
+ box-shadow : 0 4px 5px rgba(0,0,0,.15);
25
+ z-index: 999;
26
+ }
27
+ /* @end */
28
+
29
+ /* @group Single Chosen */
30
+ .chzn-container-single .chzn-single {
31
+ background-color: #fff;
32
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
33
+ background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
34
+ background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
35
+ background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
36
+ background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
37
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
38
+ background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%);
39
+ -webkit-border-radius: 4px;
40
+ -moz-border-radius : 4px;
41
+ border-radius : 4px;
42
+ -moz-background-clip : padding;
43
+ -webkit-background-clip: padding-box;
44
+ background-clip : padding-box;
45
+ border: 1px solid #aaa;
46
+ display: block;
47
+ overflow: hidden;
48
+ white-space: nowrap;
49
+ position: relative;
50
+ height: 26px;
51
+ line-height: 26px;
52
+ padding: 0 0 0 8px;
53
+ color: #444;
54
+ text-decoration: none;
55
+ }
56
+ .chzn-container-single .chzn-single span {
57
+ margin-right: 26px;
58
+ display: block;
59
+ overflow: hidden;
60
+ white-space: nowrap;
61
+ -o-text-overflow: ellipsis;
62
+ -ms-text-overflow: ellipsis;
63
+ -moz-binding: url('/xml/ellipsis.xml#ellipsis');
64
+ text-overflow: ellipsis;
65
+ }
66
+ .chzn-container-single .chzn-single div {
67
+ -webkit-border-radius: 0 4px 4px 0;
68
+ -moz-border-radius : 0 4px 4px 0;
69
+ border-radius : 0 4px 4px 0;
70
+ -moz-background-clip : padding;
71
+ -webkit-background-clip: padding-box;
72
+ background-clip : padding-box;
73
+ background: #ccc;
74
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
75
+ background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
76
+ background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
77
+ background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
78
+ background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%);
79
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 );
80
+ background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%);
81
+ border-left: 1px solid #aaa;
82
+ position: absolute;
83
+ right: 0;
84
+ top: 0;
85
+ display: block;
86
+ height: 100%;
87
+ width: 18px;
88
+ }
89
+ .chzn-container-single .chzn-single div b {
90
+ background: image_url("chosen-sprite.png") no-repeat 0 1px;
91
+ display: block;
92
+ width: 100%;
93
+ height: 100%;
94
+ }
95
+ .chzn-container-single .chzn-search {
96
+ padding: 3px 4px;
97
+ margin: 0;
98
+ white-space: nowrap;
99
+ }
100
+ .chzn-container-single .chzn-search input {
101
+ background: #fff image_url("chosen-sprite.png") no-repeat 100% -20px;
102
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
103
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
104
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
105
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
106
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
107
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
108
+ background: image_url("chosen-sprite.png") no-repeat 100% -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
109
+ margin: 1px 0;
110
+ padding: 4px 20px 4px 5px;
111
+ outline: 0;
112
+ border: 1px solid #aaa;
113
+ font-family: sans-serif;
114
+ font-size: 1em;
115
+ }
116
+ .chzn-container-single .chzn-drop {
117
+ -webkit-border-radius: 0 0 4px 4px;
118
+ -moz-border-radius : 0 0 4px 4px;
119
+ border-radius : 0 0 4px 4px;
120
+ -moz-background-clip : padding;
121
+ -webkit-background-clip: padding-box;
122
+ background-clip : padding-box;
123
+ }
124
+ /* @end */
125
+
126
+ /* @group Multi Chosen */
127
+ .chzn-container-multi .chzn-choices {
128
+ background-color: #fff;
129
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
130
+ background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
131
+ background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
132
+ background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
133
+ background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
134
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
135
+ background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%);
136
+ border: 1px solid #aaa;
137
+ margin: 0;
138
+ padding: 0;
139
+ cursor: text;
140
+ overflow: hidden;
141
+ height: auto !important;
142
+ height: 1%;
143
+ position: relative;
144
+ }
145
+ .chzn-container-multi .chzn-choices li {
146
+ float: left;
147
+ list-style: none;
148
+ }
149
+ .chzn-container-multi .chzn-choices .search-field {
150
+ white-space: nowrap;
151
+ margin: 0;
152
+ padding: 0;
153
+ }
154
+ .chzn-container-multi .chzn-choices .search-field input {
155
+ color: #666;
156
+ background: transparent !important;
157
+ border: 0 !important;
158
+ padding: 5px;
159
+ margin: 1px 0;
160
+ outline: 0;
161
+ -webkit-box-shadow: none;
162
+ -moz-box-shadow : none;
163
+ -o-box-shadow : none;
164
+ box-shadow : none;
165
+ }
166
+ .chzn-container-multi .chzn-choices .search-field .default {
167
+ color: #999;
168
+ }
169
+ .chzn-container-multi .chzn-choices .search-choice {
170
+ -webkit-border-radius: 3px;
171
+ -moz-border-radius : 3px;
172
+ border-radius : 3px;
173
+ -moz-background-clip : padding;
174
+ -webkit-background-clip: padding-box;
175
+ background-clip : padding-box;
176
+ background-color: #e4e4e4;
177
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee));
178
+ background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
179
+ background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
180
+ background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%);
181
+ background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
182
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 );
183
+ background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
184
+ color: #333;
185
+ border: 1px solid #b4b4b4;
186
+ line-height: 13px;
187
+ padding: 3px 19px 3px 6px;
188
+ margin: 3px 0 3px 5px;
189
+ position: relative;
190
+ }
191
+ .chzn-container-multi .chzn-choices .search-choice span {
192
+ cursor: default;
193
+ }
194
+ .chzn-container-multi .chzn-choices .search-choice-focus {
195
+ background: #d4d4d4;
196
+ }
197
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
198
+ display: block;
199
+ position: absolute;
200
+ right: 5px;
201
+ top: 6px;
202
+ width: 8px;
203
+ height: 9px;
204
+ font-size: 1px;
205
+ background: url(chosen-sprite.png) right top no-repeat;
206
+ }
207
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
208
+ background-position: right -9px;
209
+ }
210
+ .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
211
+ background-position: right -9px;
212
+ }
213
+ /* @end */
214
+
215
+ /* @group Results */
216
+ .chzn-container .chzn-results {
217
+ margin: 0 4px 4px 0;
218
+ max-height: 190px;
219
+ padding: 0 0 0 4px;
220
+ position: relative;
221
+ overflow-x: hidden;
222
+ overflow-y: auto;
223
+ }
224
+ .chzn-container-multi .chzn-results {
225
+ margin: -1px 0 0;
226
+ padding: 0;
227
+ }
228
+ .chzn-container .chzn-results li {
229
+ line-height: 80%;
230
+ padding: 7px 7px 8px;
231
+ margin: 0;
232
+ list-style: none;
233
+ }
234
+ .chzn-container .chzn-results .active-result {
235
+ cursor: pointer;
236
+ }
237
+ .chzn-container .chzn-results .highlighted {
238
+ background: #3875d7;
239
+ color: #fff;
240
+ }
241
+ .chzn-container .chzn-results li em {
242
+ background: #feffde;
243
+ font-style: normal;
244
+ }
245
+ .chzn-container .chzn-results .highlighted em {
246
+ background: transparent;
247
+ }
248
+ .chzn-container .chzn-results .no-results {
249
+ background: #f4f4f4;
250
+ }
251
+ .chzn-container .chzn-results .group-result {
252
+ cursor: default;
253
+ color: #999;
254
+ font-weight: bold;
255
+ }
256
+ .chzn-container .chzn-results .group-option {
257
+ padding-left: 20px;
258
+ }
259
+ .chzn-container-multi .chzn-drop .result-selected {
260
+ display: none;
261
+ }
262
+ /* @end */
263
+
264
+ /* @group Active */
265
+ .chzn-container-active .chzn-single {
266
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
267
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
268
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
269
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
270
+ border: 1px solid #5897fb;
271
+ }
272
+ .chzn-container-active .chzn-single-with-drop {
273
+ border: 1px solid #aaa;
274
+ -webkit-box-shadow: 0 1px 0 #fff inset;
275
+ -moz-box-shadow : 0 1px 0 #fff inset;
276
+ -o-box-shadow : 0 1px 0 #fff inset;
277
+ box-shadow : 0 1px 0 #fff inset;
278
+ background-color: #eee;
279
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
280
+ background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%);
281
+ background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
282
+ background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
283
+ background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%);
284
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
285
+ background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
286
+ -webkit-border-bottom-left-radius : 0;
287
+ -webkit-border-bottom-right-radius: 0;
288
+ -moz-border-radius-bottomleft : 0;
289
+ -moz-border-radius-bottomright: 0;
290
+ border-bottom-left-radius : 0;
291
+ border-bottom-right-radius: 0;
292
+ }
293
+ .chzn-container-active .chzn-single-with-drop div {
294
+ background: transparent;
295
+ border-left: none;
296
+ }
297
+ .chzn-container-active .chzn-single-with-drop div b {
298
+ background-position: -18px 1px;
299
+ }
300
+ .chzn-container-active .chzn-choices {
301
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
302
+ -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
303
+ -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
304
+ box-shadow : 0 0 5px rgba(0,0,0,.3);
305
+ border: 1px solid #5897fb;
306
+ }
307
+ .chzn-container-active .chzn-choices .search-field input {
308
+ color: #111 !important;
309
+ }
310
+ /* @end */
311
+
312
+ /* @group Right to Left */
313
+ .chzn-rtl { direction:rtl;text-align: right; }
314
+ .chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }
315
+ .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; }
316
+ .chzn-rtl .chzn-single div {
317
+ left: 0; right: auto;
318
+ border-left: none; border-right: 1px solid #aaaaaa;
319
+ -webkit-border-radius: 4px 0 0 4px;
320
+ -moz-border-radius : 4px 0 0 4px;
321
+ border-radius : 4px 0 0 4px;
322
+ }
323
+ .chzn-rtl .chzn-choices li { float: right; }
324
+ .chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; }
325
+ .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;}
326
+ .chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; }
327
+ .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; }
328
+ .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
329
+ .chzn-rtl .chzn-search input {
330
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, #ffffff;
331
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
332
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
333
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
334
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
335
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
336
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
337
+ background: image_url("chosen-sprite.png") no-repeat -38px -20px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
338
+ padding: 4px 5px 4px 20px;
339
+ }
340
+ /* @end */
@@ -0,0 +1,787 @@
1
+ // Chosen, a Select Box Enhancer for jQuery and Protoype
2
+ // by Patrick Filler for Harvest, http://getharvest.com
3
+ //
4
+ // Version 0.9.1
5
+ // Full source at https://github.com/harvesthq/chosen
6
+ // Copyright (c) 2011 Harvest http://getharvest.com
7
+
8
+ // MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
9
+ // This file is generated by `cake build`, do not edit it by hand.
10
+ (function() {
11
+ /*
12
+ Chosen source: generate output using 'cake build'
13
+ Copyright (c) 2011 by Harvest
14
+ */ var $, Chosen, get_side_border_padding, root;
15
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
16
+ root = this;
17
+ $ = jQuery;
18
+ $.fn.extend({
19
+ chosen: function(data, options) {
20
+ return $(this).each(function(input_field) {
21
+ if (!($(this)).hasClass("chzn-done")) {
22
+ return new Chosen(this, data, options);
23
+ }
24
+ });
25
+ }
26
+ });
27
+ Chosen = (function() {
28
+ function Chosen(elmn) {
29
+ this.set_default_values();
30
+ this.form_field = elmn;
31
+ this.form_field_jq = $(this.form_field);
32
+ this.is_multiple = this.form_field.multiple;
33
+ this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
34
+ this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
35
+ this.set_up_html();
36
+ this.register_observers();
37
+ this.form_field_jq.addClass("chzn-done");
38
+ }
39
+ Chosen.prototype.set_default_values = function() {
40
+ this.click_test_action = __bind(function(evt) {
41
+ return this.test_active_click(evt);
42
+ }, this);
43
+ this.active_field = false;
44
+ this.mouse_on_container = false;
45
+ this.results_showing = false;
46
+ this.result_highlighted = null;
47
+ this.result_single_selected = null;
48
+ return this.choices = 0;
49
+ };
50
+ Chosen.prototype.set_up_html = function() {
51
+ var container_div, dd_top, dd_width, sf_width;
52
+ this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
53
+ this.container_id += "_chzn";
54
+ this.f_width = this.form_field_jq.outerWidth();
55
+ this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
56
+ container_div = $("<div />", {
57
+ id: this.container_id,
58
+ "class": "chzn-container " + (this.is_rtl ? ' chzn-rtl' : void 0),
59
+ style: 'width: ' + this.f_width + 'px;'
60
+ });
61
+ if (this.is_multiple) {
62
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
63
+ } else {
64
+ container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>');
65
+ }
66
+ this.form_field_jq.hide().after(container_div);
67
+ this.container = $('#' + this.container_id);
68
+ this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
69
+ this.dropdown = this.container.find('div.chzn-drop').first();
70
+ dd_top = this.container.height();
71
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
72
+ this.dropdown.css({
73
+ "width": dd_width + "px",
74
+ "top": dd_top + "px"
75
+ });
76
+ this.search_field = this.container.find('input').first();
77
+ this.search_results = this.container.find('ul.chzn-results').first();
78
+ this.search_field_scale();
79
+ this.search_no_results = this.container.find('li.no-results').first();
80
+ if (this.is_multiple) {
81
+ this.search_choices = this.container.find('ul.chzn-choices').first();
82
+ this.search_container = this.container.find('li.search-field').first();
83
+ } else {
84
+ this.search_container = this.container.find('div.chzn-search').first();
85
+ this.selected_item = this.container.find('.chzn-single').first();
86
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
87
+ this.search_field.css({
88
+ "width": sf_width + "px"
89
+ });
90
+ }
91
+ this.results_build();
92
+ return this.set_tab_index();
93
+ };
94
+ Chosen.prototype.register_observers = function() {
95
+ this.container.click(__bind(function(evt) {
96
+ return this.container_click(evt);
97
+ }, this));
98
+ this.container.mouseenter(__bind(function(evt) {
99
+ return this.mouse_enter(evt);
100
+ }, this));
101
+ this.container.mouseleave(__bind(function(evt) {
102
+ return this.mouse_leave(evt);
103
+ }, this));
104
+ this.search_results.click(__bind(function(evt) {
105
+ return this.search_results_click(evt);
106
+ }, this));
107
+ this.search_results.mouseover(__bind(function(evt) {
108
+ return this.search_results_mouseover(evt);
109
+ }, this));
110
+ this.search_results.mouseout(__bind(function(evt) {
111
+ return this.search_results_mouseout(evt);
112
+ }, this));
113
+ this.form_field_jq.bind("liszt:updated", __bind(function(evt) {
114
+ return this.results_update_field(evt);
115
+ }, this));
116
+ this.search_field.blur(__bind(function(evt) {
117
+ return this.input_blur(evt);
118
+ }, this));
119
+ this.search_field.keyup(__bind(function(evt) {
120
+ return this.keyup_checker(evt);
121
+ }, this));
122
+ this.search_field.keydown(__bind(function(evt) {
123
+ return this.keydown_checker(evt);
124
+ }, this));
125
+ if (this.is_multiple) {
126
+ this.search_choices.click(__bind(function(evt) {
127
+ return this.choices_click(evt);
128
+ }, this));
129
+ return this.search_field.focus(__bind(function(evt) {
130
+ return this.input_focus(evt);
131
+ }, this));
132
+ } else {
133
+ return this.selected_item.focus(__bind(function(evt) {
134
+ return this.activate_field(evt);
135
+ }, this));
136
+ }
137
+ };
138
+ Chosen.prototype.container_click = function(evt) {
139
+ if (evt && evt.type === "click") {
140
+ evt.stopPropagation();
141
+ }
142
+ if (!this.pending_destroy_click) {
143
+ if (!this.active_field) {
144
+ if (this.is_multiple) {
145
+ this.search_field.val("");
146
+ }
147
+ $(document).click(this.click_test_action);
148
+ this.results_show();
149
+ } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
150
+ evt.preventDefault();
151
+ this.results_toggle();
152
+ }
153
+ return this.activate_field();
154
+ } else {
155
+ return this.pending_destroy_click = false;
156
+ }
157
+ };
158
+ Chosen.prototype.mouse_enter = function() {
159
+ return this.mouse_on_container = true;
160
+ };
161
+ Chosen.prototype.mouse_leave = function() {
162
+ return this.mouse_on_container = false;
163
+ };
164
+ Chosen.prototype.input_focus = function(evt) {
165
+ if (!this.active_field) {
166
+ return setTimeout((__bind(function() {
167
+ return this.container_click();
168
+ }, this)), 50);
169
+ }
170
+ };
171
+ Chosen.prototype.input_blur = function(evt) {
172
+ if (!this.mouse_on_container) {
173
+ this.active_field = false;
174
+ return setTimeout((__bind(function() {
175
+ return this.blur_test();
176
+ }, this)), 100);
177
+ }
178
+ };
179
+ Chosen.prototype.blur_test = function(evt) {
180
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
181
+ return this.close_field();
182
+ }
183
+ };
184
+ Chosen.prototype.close_field = function() {
185
+ $(document).unbind("click", this.click_test_action);
186
+ if (!this.is_multiple) {
187
+ this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
188
+ this.search_field.attr("tabindex", -1);
189
+ }
190
+ this.active_field = false;
191
+ this.results_hide();
192
+ this.container.removeClass("chzn-container-active");
193
+ this.winnow_results_clear();
194
+ this.clear_backstroke();
195
+ this.show_search_field_default();
196
+ return this.search_field_scale();
197
+ };
198
+ Chosen.prototype.activate_field = function() {
199
+ if (!this.is_multiple && !this.active_field) {
200
+ this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
201
+ this.selected_item.attr("tabindex", -1);
202
+ }
203
+ this.container.addClass("chzn-container-active");
204
+ this.active_field = true;
205
+ this.search_field.val(this.search_field.val());
206
+ return this.search_field.focus();
207
+ };
208
+ Chosen.prototype.test_active_click = function(evt) {
209
+ if ($(evt.target).parents('#' + this.container_id).length) {
210
+ return this.active_field = true;
211
+ } else {
212
+ return this.close_field();
213
+ }
214
+ };
215
+ Chosen.prototype.results_build = function() {
216
+ var content, data, startTime, _i, _len, _ref;
217
+ startTime = new Date();
218
+ this.parsing = true;
219
+ this.results_data = root.SelectParser.select_to_array(this.form_field);
220
+ if (this.is_multiple && this.choices > 0) {
221
+ this.search_choices.find("li.search-choice").remove();
222
+ this.choices = 0;
223
+ } else if (!this.is_multiple) {
224
+ this.selected_item.find("span").text(this.default_text);
225
+ }
226
+ content = '';
227
+ _ref = this.results_data;
228
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
229
+ data = _ref[_i];
230
+ if (data.group) {
231
+ content += this.result_add_group(data);
232
+ } else if (!data.empty) {
233
+ content += this.result_add_option(data);
234
+ if (data.selected && this.is_multiple) {
235
+ this.choice_build(data);
236
+ } else if (data.selected && !this.is_multiple) {
237
+ this.selected_item.find("span").text(data.text);
238
+ }
239
+ }
240
+ }
241
+ this.show_search_field_default();
242
+ this.search_field_scale();
243
+ this.search_results.html(content);
244
+ return this.parsing = false;
245
+ };
246
+ Chosen.prototype.result_add_group = function(group) {
247
+ if (!group.disabled) {
248
+ group.dom_id = this.container_id + "_g_" + group.array_index;
249
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
250
+ } else {
251
+ return "";
252
+ }
253
+ };
254
+ Chosen.prototype.result_add_option = function(option) {
255
+ var classes;
256
+ if (!option.disabled) {
257
+ option.dom_id = this.container_id + "_o_" + option.array_index;
258
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
259
+ if (option.selected) {
260
+ classes.push("result-selected");
261
+ }
262
+ if (option.group_array_index != null) {
263
+ classes.push("group-option");
264
+ }
265
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.html + '</li>';
266
+ } else {
267
+ return "";
268
+ }
269
+ };
270
+ Chosen.prototype.results_update_field = function() {
271
+ this.result_clear_highlight();
272
+ this.result_single_selected = null;
273
+ return this.results_build();
274
+ };
275
+ Chosen.prototype.result_do_highlight = function(el) {
276
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
277
+ if (el.length) {
278
+ this.result_clear_highlight();
279
+ this.result_highlight = el;
280
+ this.result_highlight.addClass("highlighted");
281
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
282
+ visible_top = this.search_results.scrollTop();
283
+ visible_bottom = maxHeight + visible_top;
284
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
285
+ high_bottom = high_top + this.result_highlight.outerHeight();
286
+ if (high_bottom >= visible_bottom) {
287
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
288
+ } else if (high_top < visible_top) {
289
+ return this.search_results.scrollTop(high_top);
290
+ }
291
+ }
292
+ };
293
+ Chosen.prototype.result_clear_highlight = function() {
294
+ if (this.result_highlight) {
295
+ this.result_highlight.removeClass("highlighted");
296
+ }
297
+ return this.result_highlight = null;
298
+ };
299
+ Chosen.prototype.results_toggle = function() {
300
+ if (this.results_showing) {
301
+ return this.results_hide();
302
+ } else {
303
+ return this.results_show();
304
+ }
305
+ };
306
+ Chosen.prototype.results_show = function() {
307
+ var dd_top;
308
+ if (!this.is_multiple) {
309
+ this.selected_item.addClass("chzn-single-with-drop");
310
+ if (this.result_single_selected) {
311
+ this.result_do_highlight(this.result_single_selected);
312
+ }
313
+ }
314
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
315
+ this.dropdown.css({
316
+ "top": dd_top + "px",
317
+ "left": 0
318
+ });
319
+ this.results_showing = true;
320
+ this.search_field.focus();
321
+ this.search_field.val(this.search_field.val());
322
+ return this.winnow_results();
323
+ };
324
+ Chosen.prototype.results_hide = function() {
325
+ if (!this.is_multiple) {
326
+ this.selected_item.removeClass("chzn-single-with-drop");
327
+ }
328
+ this.result_clear_highlight();
329
+ this.dropdown.css({
330
+ "left": "-9000px"
331
+ });
332
+ return this.results_showing = false;
333
+ };
334
+ Chosen.prototype.set_tab_index = function(el) {
335
+ var ti;
336
+ if (this.form_field_jq.attr("tabindex")) {
337
+ ti = this.form_field_jq.attr("tabindex");
338
+ this.form_field_jq.attr("tabindex", -1);
339
+ if (this.is_multiple) {
340
+ return this.search_field.attr("tabindex", ti);
341
+ } else {
342
+ this.selected_item.attr("tabindex", ti);
343
+ return this.search_field.attr("tabindex", -1);
344
+ }
345
+ }
346
+ };
347
+ Chosen.prototype.show_search_field_default = function() {
348
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
349
+ this.search_field.val(this.default_text);
350
+ return this.search_field.addClass("default");
351
+ } else {
352
+ this.search_field.val("");
353
+ return this.search_field.removeClass("default");
354
+ }
355
+ };
356
+ Chosen.prototype.search_results_click = function(evt) {
357
+ var target;
358
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
359
+ if (target.length) {
360
+ this.result_highlight = target;
361
+ return this.result_select();
362
+ }
363
+ };
364
+ Chosen.prototype.search_results_mouseover = function(evt) {
365
+ var target;
366
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
367
+ if (target) {
368
+ return this.result_do_highlight(target);
369
+ }
370
+ };
371
+ Chosen.prototype.search_results_mouseout = function(evt) {
372
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
373
+ return this.result_clear_highlight();
374
+ }
375
+ };
376
+ Chosen.prototype.choices_click = function(evt) {
377
+ evt.preventDefault();
378
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
379
+ return this.results_show();
380
+ }
381
+ };
382
+ Chosen.prototype.choice_build = function(item) {
383
+ var choice_id, link;
384
+ choice_id = this.container_id + "_c_" + item.array_index;
385
+ this.choices += 1;
386
+ this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.html + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
387
+ link = $('#' + choice_id).find("a").first();
388
+ return link.click(__bind(function(evt) {
389
+ return this.choice_destroy_link_click(evt);
390
+ }, this));
391
+ };
392
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
393
+ evt.preventDefault();
394
+ this.pending_destroy_click = true;
395
+ return this.choice_destroy($(evt.target));
396
+ };
397
+ Chosen.prototype.choice_destroy = function(link) {
398
+ this.choices -= 1;
399
+ this.show_search_field_default();
400
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
401
+ this.results_hide();
402
+ }
403
+ this.result_deselect(link.attr("rel"));
404
+ return link.parents('li').first().remove();
405
+ };
406
+ Chosen.prototype.result_select = function() {
407
+ var high, high_id, item, position;
408
+ if (this.result_highlight) {
409
+ high = this.result_highlight;
410
+ high_id = high.attr("id");
411
+ this.result_clear_highlight();
412
+ high.addClass("result-selected");
413
+ if (this.is_multiple) {
414
+ this.result_deactivate(high);
415
+ } else {
416
+ this.result_single_selected = high;
417
+ }
418
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
419
+ item = this.results_data[position];
420
+ item.selected = true;
421
+ this.form_field.options[item.options_index].selected = true;
422
+ if (this.is_multiple) {
423
+ this.choice_build(item);
424
+ } else {
425
+ this.selected_item.find("span").first().text(item.text);
426
+ }
427
+ this.results_hide();
428
+ this.search_field.val("");
429
+ this.form_field_jq.trigger("change");
430
+ return this.search_field_scale();
431
+ }
432
+ };
433
+ Chosen.prototype.result_activate = function(el) {
434
+ return el.addClass("active-result").show();
435
+ };
436
+ Chosen.prototype.result_deactivate = function(el) {
437
+ return el.removeClass("active-result").hide();
438
+ };
439
+ Chosen.prototype.result_deselect = function(pos) {
440
+ var result, result_data;
441
+ result_data = this.results_data[pos];
442
+ result_data.selected = false;
443
+ this.form_field.options[result_data.options_index].selected = false;
444
+ result = $("#" + this.container_id + "_o_" + pos);
445
+ result.removeClass("result-selected").addClass("active-result").show();
446
+ this.result_clear_highlight();
447
+ this.winnow_results();
448
+ this.form_field_jq.trigger("change");
449
+ return this.search_field_scale();
450
+ };
451
+ Chosen.prototype.results_search = function(evt) {
452
+ if (this.results_showing) {
453
+ return this.winnow_results();
454
+ } else {
455
+ return this.results_show();
456
+ }
457
+ };
458
+ Chosen.prototype.winnow_results = function() {
459
+ var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
460
+ startTime = new Date();
461
+ this.no_results_clear();
462
+ results = 0;
463
+ searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
464
+ regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
465
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
466
+ _ref = this.results_data;
467
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
468
+ option = _ref[_i];
469
+ if (!option.disabled && !option.empty) {
470
+ if (option.group) {
471
+ $('#' + option.dom_id).hide();
472
+ } else if (!(this.is_multiple && option.selected)) {
473
+ found = false;
474
+ result_id = option.dom_id;
475
+ if (regex.test(option.html)) {
476
+ found = true;
477
+ results += 1;
478
+ } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
479
+ parts = option.html.replace(/\[|\]/g, "").split(" ");
480
+ if (parts.length) {
481
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
482
+ part = parts[_j];
483
+ if (regex.test(part)) {
484
+ found = true;
485
+ results += 1;
486
+ }
487
+ }
488
+ }
489
+ }
490
+ if (found) {
491
+ if (searchText.length) {
492
+ startpos = option.html.search(zregex);
493
+ text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
494
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
495
+ } else {
496
+ text = option.html;
497
+ }
498
+ if ($("#" + result_id).html !== text) {
499
+ $("#" + result_id).html(text);
500
+ }
501
+ this.result_activate($("#" + result_id));
502
+ if (option.group_array_index != null) {
503
+ $("#" + this.results_data[option.group_array_index].dom_id).show();
504
+ }
505
+ } else {
506
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
507
+ this.result_clear_highlight();
508
+ }
509
+ this.result_deactivate($("#" + result_id));
510
+ }
511
+ }
512
+ }
513
+ }
514
+ if (results < 1 && searchText.length) {
515
+ return this.no_results(searchText);
516
+ } else {
517
+ return this.winnow_results_set_highlight();
518
+ }
519
+ };
520
+ Chosen.prototype.winnow_results_clear = function() {
521
+ var li, lis, _i, _len, _results;
522
+ this.search_field.val("");
523
+ lis = this.search_results.find("li");
524
+ _results = [];
525
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
526
+ li = lis[_i];
527
+ li = $(li);
528
+ _results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
529
+ }
530
+ return _results;
531
+ };
532
+ Chosen.prototype.winnow_results_set_highlight = function() {
533
+ var do_high, selected_results;
534
+ if (!this.result_highlight) {
535
+ selected_results = !this.is_multiple ? this.search_results.find(".result-selected") : [];
536
+ do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
537
+ if (do_high != null) {
538
+ return this.result_do_highlight(do_high);
539
+ }
540
+ }
541
+ };
542
+ Chosen.prototype.no_results = function(terms) {
543
+ var no_results_html;
544
+ no_results_html = $('<li class="no-results">No results match "<span></span>"</li>');
545
+ no_results_html.find("span").first().html(terms);
546
+ return this.search_results.append(no_results_html);
547
+ };
548
+ Chosen.prototype.no_results_clear = function() {
549
+ return this.search_results.find(".no-results").remove();
550
+ };
551
+ Chosen.prototype.keydown_arrow = function() {
552
+ var first_active, next_sib;
553
+ if (!this.result_highlight) {
554
+ first_active = this.search_results.find("li.active-result").first();
555
+ if (first_active) {
556
+ this.result_do_highlight($(first_active));
557
+ }
558
+ } else if (this.results_showing) {
559
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
560
+ if (next_sib) {
561
+ this.result_do_highlight(next_sib);
562
+ }
563
+ }
564
+ if (!this.results_showing) {
565
+ return this.results_show();
566
+ }
567
+ };
568
+ Chosen.prototype.keyup_arrow = function() {
569
+ var prev_sibs;
570
+ if (!this.results_showing && !this.is_multiple) {
571
+ return this.results_show();
572
+ } else if (this.result_highlight) {
573
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
574
+ if (prev_sibs.length) {
575
+ return this.result_do_highlight(prev_sibs.first());
576
+ } else {
577
+ if (this.choices > 0) {
578
+ this.results_hide();
579
+ }
580
+ return this.result_clear_highlight();
581
+ }
582
+ }
583
+ };
584
+ Chosen.prototype.keydown_backstroke = function() {
585
+ if (this.pending_backstroke) {
586
+ this.choice_destroy(this.pending_backstroke.find("a").first());
587
+ return this.clear_backstroke();
588
+ } else {
589
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
590
+ return this.pending_backstroke.addClass("search-choice-focus");
591
+ }
592
+ };
593
+ Chosen.prototype.clear_backstroke = function() {
594
+ if (this.pending_backstroke) {
595
+ this.pending_backstroke.removeClass("search-choice-focus");
596
+ }
597
+ return this.pending_backstroke = null;
598
+ };
599
+ Chosen.prototype.keyup_checker = function(evt) {
600
+ var stroke, _ref;
601
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
602
+ this.search_field_scale();
603
+ switch (stroke) {
604
+ case 8:
605
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
606
+ return this.keydown_backstroke();
607
+ } else if (!this.pending_backstroke) {
608
+ this.result_clear_highlight();
609
+ return this.results_search();
610
+ }
611
+ break;
612
+ case 13:
613
+ evt.preventDefault();
614
+ if (this.results_showing) {
615
+ return this.result_select();
616
+ }
617
+ break;
618
+ case 27:
619
+ if (this.results_showing) {
620
+ return this.results_hide();
621
+ }
622
+ break;
623
+ case 9:
624
+ case 38:
625
+ case 40:
626
+ case 16:
627
+ break;
628
+ default:
629
+ return this.results_search();
630
+ }
631
+ };
632
+ Chosen.prototype.keydown_checker = function(evt) {
633
+ var stroke, _ref;
634
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
635
+ this.search_field_scale();
636
+ if (stroke !== 8 && this.pending_backstroke) {
637
+ this.clear_backstroke();
638
+ }
639
+ switch (stroke) {
640
+ case 8:
641
+ this.backstroke_length = this.search_field.val().length;
642
+ break;
643
+ case 9:
644
+ this.mouse_on_container = false;
645
+ break;
646
+ case 13:
647
+ evt.preventDefault();
648
+ break;
649
+ case 38:
650
+ evt.preventDefault();
651
+ this.keyup_arrow();
652
+ break;
653
+ case 40:
654
+ this.keydown_arrow();
655
+ break;
656
+ }
657
+ };
658
+ Chosen.prototype.search_field_scale = function() {
659
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
660
+ if (this.is_multiple) {
661
+ h = 0;
662
+ w = 0;
663
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
664
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
665
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
666
+ style = styles[_i];
667
+ style_block += style + ":" + this.search_field.css(style) + ";";
668
+ }
669
+ div = $('<div />', {
670
+ 'style': style_block
671
+ });
672
+ div.text(this.search_field.val());
673
+ $('body').append(div);
674
+ w = div.width() + 25;
675
+ div.remove();
676
+ if (w > this.f_width - 10) {
677
+ w = this.f_width - 10;
678
+ }
679
+ this.search_field.css({
680
+ 'width': w + 'px'
681
+ });
682
+ dd_top = this.container.height();
683
+ return this.dropdown.css({
684
+ "top": dd_top + "px"
685
+ });
686
+ }
687
+ };
688
+ Chosen.prototype.generate_field_id = function() {
689
+ var new_id;
690
+ new_id = this.generate_random_id();
691
+ this.form_field.id = new_id;
692
+ return new_id;
693
+ };
694
+ Chosen.prototype.generate_random_id = function() {
695
+ var string;
696
+ string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
697
+ while ($("#" + string).length > 0) {
698
+ string += this.generate_random_char();
699
+ }
700
+ return string;
701
+ };
702
+ Chosen.prototype.generate_random_char = function() {
703
+ var chars, newchar, rand;
704
+ chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
705
+ rand = Math.floor(Math.random() * chars.length);
706
+ return newchar = chars.substring(rand, rand + 1);
707
+ };
708
+ return Chosen;
709
+ })();
710
+ get_side_border_padding = function(elmt) {
711
+ var side_border_padding;
712
+ return side_border_padding = elmt.outerWidth() - elmt.width();
713
+ };
714
+ root.get_side_border_padding = get_side_border_padding;
715
+ }).call(this);
716
+ (function() {
717
+ var SelectParser;
718
+ SelectParser = (function() {
719
+ function SelectParser() {
720
+ this.options_index = 0;
721
+ this.parsed = [];
722
+ }
723
+ SelectParser.prototype.add_node = function(child) {
724
+ if (child.nodeName === "OPTGROUP") {
725
+ return this.add_group(child);
726
+ } else {
727
+ return this.add_option(child);
728
+ }
729
+ };
730
+ SelectParser.prototype.add_group = function(group) {
731
+ var group_position, option, _i, _len, _ref, _results;
732
+ group_position = this.parsed.length;
733
+ this.parsed.push({
734
+ array_index: group_position,
735
+ group: true,
736
+ label: group.label,
737
+ children: 0,
738
+ disabled: group.disabled
739
+ });
740
+ _ref = group.childNodes;
741
+ _results = [];
742
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
743
+ option = _ref[_i];
744
+ _results.push(this.add_option(option, group_position, group.disabled));
745
+ }
746
+ return _results;
747
+ };
748
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
749
+ if (option.nodeName === "OPTION") {
750
+ if (option.text !== "") {
751
+ if (group_position != null) {
752
+ this.parsed[group_position].children += 1;
753
+ }
754
+ this.parsed.push({
755
+ array_index: this.parsed.length,
756
+ options_index: this.options_index,
757
+ value: option.value,
758
+ text: option.text,
759
+ html: option.innerHTML,
760
+ selected: option.selected,
761
+ disabled: group_disabled === true ? group_disabled : option.disabled,
762
+ group_array_index: group_position
763
+ });
764
+ } else {
765
+ this.parsed.push({
766
+ array_index: this.parsed.length,
767
+ options_index: this.options_index,
768
+ empty: true
769
+ });
770
+ }
771
+ return this.options_index += 1;
772
+ }
773
+ };
774
+ return SelectParser;
775
+ })();
776
+ SelectParser.select_to_array = function(select) {
777
+ var child, parser, _i, _len, _ref;
778
+ parser = new SelectParser();
779
+ _ref = select.childNodes;
780
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
781
+ child = _ref[_i];
782
+ parser.add_node(child);
783
+ }
784
+ return parser.parsed;
785
+ };
786
+ this.SelectParser = SelectParser;
787
+ }).call(this);
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: porthos
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 3.0.0.beta1
5
+ version: 3.0.0.beta2
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Joel Junstr\xC3\xB6m"
@@ -700,6 +700,12 @@ files:
700
700
  - app/views/pages/templates/default/search.html.erb
701
701
  - app/views/pages/templates/default/show.html.erb
702
702
  - app/views/shared/404.html.erb
703
+ - config/initializers/locale.rb
704
+ - config/initializers/mime_types.rb
705
+ - config/initializers/overrides.rb
706
+ - config/initializers/tanker.rb
707
+ - config/locales/sv-SE.yml
708
+ - config/routes.rb
703
709
  - lib/generators/porthos/porthos_generator.rb
704
710
  - lib/generators/porthos/templates/mongo.yml
705
711
  - lib/generators/porthos/USAGE
@@ -731,12 +737,9 @@ files:
731
737
  - lib/porthos/version.rb
732
738
  - lib/porthos.rb
733
739
  - lib/tasks/porthos_tasks.rake
734
- - config/initializers/locale.rb
735
- - config/initializers/mime_types.rb
736
- - config/initializers/overrides.rb
737
- - config/initializers/tanker.rb
738
- - config/locales/sv-SE.yml
739
- - config/routes.rb
740
+ - vendor/assets/chosen/chosen-sprite.png
741
+ - vendor/assets/chosen/chosen.css.scss
742
+ - vendor/assets/chosen/chosen.js
740
743
  - MIT-LICENSE
741
744
  - Rakefile
742
745
  - Gemfile
@@ -758,9 +761,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
758
761
  required_rubygems_version: !ruby/object:Gem::Requirement
759
762
  none: false
760
763
  requirements:
761
- - - ">="
764
+ - - ">"
762
765
  - !ruby/object:Gem::Version
763
- version: "0"
766
+ version: 1.3.1
764
767
  requirements: []
765
768
 
766
769
  rubyforge_project: