rollout_ui 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/lib/rollout_ui/feature.rb +6 -2
  2. data/lib/rollout_ui/version.rb +1 -1
  3. data/spec/dummy/log/test.log +231 -10862
  4. data/spec/lib/rollout_ui/feature_spec.rb +3 -1
  5. metadata +7 -72
  6. data/spec/dummy/log/development.log +0 -15639
  7. data/spec/dummy/log/production.log +0 -19
  8. data/spec/dummy/log/stdout.log +0 -3192
  9. data/spec/dummy/tmp/cache/assets/C44/C60/sprockets%2F32619064c16276c9031bc469f111b6f1 +0 -369
  10. data/spec/dummy/tmp/cache/assets/CA9/290/sprockets%2Ffde33cd38c83e40045112ef236908326 +0 -1012
  11. data/spec/dummy/tmp/cache/assets/CB1/0F0/sprockets%2F097929f05538ada1621d2b34d0748fb8 +0 -0
  12. data/spec/dummy/tmp/cache/assets/D0C/460/sprockets%2Fbf6917215d0871b152f3d3ec4ece0486 +0 -0
  13. data/spec/dummy/tmp/cache/assets/D1E/9E0/sprockets%2Fb92e466db7d4e78f107d8386ea19560a +0 -0
  14. data/spec/dummy/tmp/cache/assets/D22/D60/sprockets%2F6c1d9d3c966b8286c00d8dd46bd54598 +0 -371
  15. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  16. data/spec/dummy/tmp/cache/assets/D3E/870/sprockets%2F82e617ed3b33c78bb8340cdbd603d189 +0 -1015
  17. data/spec/dummy/tmp/cache/assets/D45/1B0/sprockets%2F89743b2dcefe650c86e16c60dc248a26 +0 -0
  18. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  19. data/spec/dummy/tmp/cache/assets/D62/900/sprockets%2F4d745068b58dab09efc05fd3bd030c05 +0 -1387
  20. data/spec/dummy/tmp/cache/assets/D71/220/sprockets%2Fd07f8aed535b53034c9a4489bd6cb45d +0 -374
  21. data/spec/dummy/tmp/cache/assets/D74/0C0/sprockets%2F28c2d3c4b8de13fe5b746c94d96042dd +0 -0
  22. data/spec/dummy/tmp/cache/assets/D7D/C20/sprockets%2Ff5f71be7464ea98757bc8e41df514a4b +0 -433
  23. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D93/100/sprockets%2Ffd9e48a89d83e7b764e2de324ee888b6 +0 -917
  25. data/spec/dummy/tmp/cache/assets/DC2/770/sprockets%2F7f10ac108ce75bbb0e9877b50bcb22fe +0 -0
  26. data/spec/dummy/tmp/cache/assets/E00/850/sprockets%2Fd5e1f4415f71da50c8365f7ecdeca2ff +0 -436
  27. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  28. data/spec/dummy/tmp/cache/assets/E3E/230/sprockets%2F8156dcfebf95ff75b117c7e5bffb71dc +0 -372
  29. data/spec/dummy/tmp/cache/assets/E7A/F10/sprockets%2Ff3d71fbeaa5fdddf600a0ac52af1d8e2 +0 -0
  30. data/spec/dummy/tmp/capybara/capybara-201110152250496494273346.html +0 -141
  31. data/spec/dummy/tmp/capybara/capybara-201110152251237384633452.html +0 -141
  32. data/spec/dummy/tmp/capybara/capybara-201110152253073784924369.html +0 -141
  33. data/spec/dummy/tmp/capybara/capybara-201110152255118447806623.html +0 -141
  34. data/spec/dummy/tmp/capybara/capybara-201110152257286050916603.html +0 -141
  35. data/spec/dummy/tmp/capybara/capybara-201110152258202877532249.html +0 -139
  36. data/spec/dummy/tmp/capybara/capybara-201110152259224345897143.html +0 -139
  37. data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -1,371 +0,0 @@
1
- o: ActiveSupport::Cache::Entry :@expires_in0: @value{ "
2
-
3
- .chzn-container {
4
- font-size: 13px;
5
- position: relative;
6
- display: inline-block;
7
- zoom: 1;
8
- *display: inline;
9
- }
10
- .chzn-container .chzn-drop {
11
- background: #fff;
12
- border: 1px solid #aaa;
13
- border-top: 0;
14
- position: absolute;
15
- top: 29px;
16
- left: 0;
17
- -webkit-box-shadow: 0 4px 5px rgba(0,0,0,.15);
18
- -moz-box-shadow : 0 4px 5px rgba(0,0,0,.15);
19
- -o-box-shadow : 0 4px 5px rgba(0,0,0,.15);
20
- box-shadow : 0 4px 5px rgba(0,0,0,.15);
21
- z-index: 999;
22
- }
23
- /* @end */
24
-
25
- /* @group Single Chosen */
26
- .chzn-container-single .chzn-single {
27
- background-color: #fff;
28
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
29
- background-image: -webkit-linear-gradient(center bottom, #eeeeee 0%, white 50%);
30
- background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
31
- background-image: -o-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
32
- background-image: -ms-linear-gradient(top, #eeeeee 0%,#ffffff 50%);
33
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 );
34
- background-image: linear-gradient(top, #eeeeee 0%,#ffffff 50%);
35
- -webkit-border-radius: 4px;
36
- -moz-border-radius : 4px;
37
- border-radius : 4px;
38
- -moz-background-clip : padding;
39
- -webkit-background-clip: padding-box;
40
- background-clip : padding-box;
41
- border: 1px solid #aaa;
42
- display: block;
43
- overflow: hidden;
44
- white-space: nowrap;
45
- position: relative;
46
- height: 26px;
47
- line-height: 26px;
48
- padding: 0 0 0 8px;
49
- color: #444;
50
- text-decoration: none;
51
- }
52
- .chzn-container-single .chzn-single span {
53
- margin-right: 26px;
54
- display: block;
55
- overflow: hidden;
56
- white-space: nowrap;
57
- -o-text-overflow: ellipsis;
58
- -ms-text-overflow: ellipsis;
59
- text-overflow: ellipsis;
60
- }
61
- .chzn-container-single .chzn-single abbr {
62
- display: block;
63
- position: absolute;
64
- right: 26px;
65
- top: 8px;
66
- width: 12px;
67
- height: 13px;
68
- font-size: 1px;
69
- background: url(/assets/rollout_ui/chosen-sprite.png) right top no-repeat;
70
- }
71
- .chzn-container-single .chzn-single abbr:hover {
72
- background-position: right -11px;
73
- }
74
- .chzn-container-single .chzn-single div {
75
- -webkit-border-radius: 0 4px 4px 0;
76
- -moz-border-radius : 0 4px 4px 0;
77
- border-radius : 0 4px 4px 0;
78
- -moz-background-clip : padding;
79
- -webkit-background-clip: padding-box;
80
- background-clip : padding-box;
81
- background: #ccc;
82
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
83
- background-image: -webkit-linear-gradient(center bottom, #ccc 0%, #eee 60%);
84
- background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
85
- background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
86
- background-image: -ms-linear-gradient(top, #cccccc 0%,#eeeeee 60%);
87
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cccccc', endColorstr='#eeeeee',GradientType=0 );
88
- background-image: linear-gradient(top, #cccccc 0%,#eeeeee 60%);
89
- border-left: 1px solid #aaa;
90
- position: absolute;
91
- right: 0;
92
- top: 0;
93
- display: block;
94
- height: 100%;
95
- width: 18px;
96
- }
97
- .chzn-container-single .chzn-single div b {
98
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 0 1px;
99
- display: block;
100
- width: 100%;
101
- height: 100%;
102
- }
103
- .chzn-container-single .chzn-search {
104
- padding: 3px 4px;
105
- position: relative;
106
- margin: 0;
107
- white-space: nowrap;
108
- z-index: 1010;
109
- }
110
- .chzn-container-single .chzn-search input {
111
- background: #fff url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px;
112
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
113
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
114
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
115
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
116
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
117
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
118
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat 100% -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
119
- margin: 1px 0;
120
- padding: 4px 20px 4px 5px;
121
- outline: 0;
122
- border: 1px solid #aaa;
123
- font-family: sans-serif;
124
- font-size: 1em;
125
- }
126
- .chzn-container-single .chzn-drop {
127
- -webkit-border-radius: 0 0 4px 4px;
128
- -moz-border-radius : 0 0 4px 4px;
129
- border-radius : 0 0 4px 4px;
130
- -moz-background-clip : padding;
131
- -webkit-background-clip: padding-box;
132
- background-clip : padding-box;
133
- }
134
- /* @end */
135
-
136
- .chzn-container-single-nosearch .chzn-search input {
137
- position: absolute;
138
- left: -9000px;
139
- }
140
-
141
- /* @group Multi Chosen */
142
- .chzn-container-multi .chzn-choices {
143
- background-color: #fff;
144
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
145
- background-image: -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
146
- background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
147
- background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
148
- background-image: -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
149
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
150
- background-image: linear-gradient(top, #ffffff 85%,#eeeeee 99%);
151
- border: 1px solid #aaa;
152
- margin: 0;
153
- padding: 0;
154
- cursor: text;
155
- overflow: hidden;
156
- height: auto !important;
157
- height: 1%;
158
- position: relative;
159
- }
160
- .chzn-container-multi .chzn-choices li {
161
- float: left;
162
- list-style: none;
163
- }
164
- .chzn-container-multi .chzn-choices .search-field {
165
- white-space: nowrap;
166
- margin: 0;
167
- padding: 0;
168
- }
169
- .chzn-container-multi .chzn-choices .search-field input {
170
- color: #666;
171
- background: transparent !important;
172
- border: 0 !important;
173
- padding: 5px;
174
- margin: 1px 0;
175
- outline: 0;
176
- -webkit-box-shadow: none;
177
- -moz-box-shadow : none;
178
- -o-box-shadow : none;
179
- box-shadow : none;
180
- }
181
- .chzn-container-multi .chzn-choices .search-field .default {
182
- color: #999;
183
- }
184
- .chzn-container-multi .chzn-choices .search-choice {
185
- -webkit-border-radius: 3px;
186
- -moz-border-radius : 3px;
187
- border-radius : 3px;
188
- -moz-background-clip : padding;
189
- -webkit-background-clip: padding-box;
190
- background-clip : padding-box;
191
- background-color: #e4e4e4;
192
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee));
193
- background-image: -webkit-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
194
- background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
195
- background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%);
196
- background-image: -ms-linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
197
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e4e4e4', endColorstr='#eeeeee',GradientType=0 );
198
- background-image: linear-gradient(top, #e4e4e4 0%,#eeeeee 70%);
199
- color: #333;
200
- border: 1px solid #b4b4b4;
201
- line-height: 13px;
202
- padding: 3px 19px 3px 6px;
203
- margin: 3px 0 3px 5px;
204
- position: relative;
205
- }
206
- .chzn-container-multi .chzn-choices .search-choice span {
207
- cursor: default;
208
- }
209
- .chzn-container-multi .chzn-choices .search-choice-focus {
210
- background: #d4d4d4;
211
- }
212
- .chzn-container-multi .chzn-choices .search-choice .search-choice-close {
213
- display: block;
214
- position: absolute;
215
- right: 3px;
216
- top: 4px;
217
- width: 12px;
218
- height: 13px;
219
- font-size: 1px;
220
- background: url(/assets/rollout_ui/chosen-sprite.png) right top no-repeat;
221
- }
222
- .chzn-container-multi .chzn-choices .search-choice .search-choice-close:hover {
223
- background-position: right -11px;
224
- }
225
- .chzn-container-multi .chzn-choices .search-choice-focus .search-choice-close {
226
- background-position: right -11px;
227
- }
228
- /* @end */
229
-
230
- /* @group Results */
231
- .chzn-container .chzn-results {
232
- margin: 0 4px 4px 0;
233
- max-height: 190px;
234
- padding: 0 0 0 4px;
235
- position: relative;
236
- overflow-x: hidden;
237
- overflow-y: auto;
238
- }
239
- .chzn-container-multi .chzn-results {
240
- margin: -1px 0 0;
241
- padding: 0;
242
- }
243
- .chzn-container .chzn-results li {
244
- display: none;
245
- line-height: 80%;
246
- padding: 7px 7px 8px;
247
- margin: 0;
248
- list-style: none;
249
- }
250
- .chzn-container .chzn-results .active-result {
251
- cursor: pointer;
252
- display: list-item;
253
- }
254
- .chzn-container .chzn-results .highlighted {
255
- background: #3875d7;
256
- color: #fff;
257
- }
258
- .chzn-container .chzn-results li em {
259
- background: #feffde;
260
- font-style: normal;
261
- }
262
- .chzn-container .chzn-results .highlighted em {
263
- background: transparent;
264
- }
265
- .chzn-container .chzn-results .no-results {
266
- background: #f4f4f4;
267
- display: list-item;
268
- }
269
- .chzn-container .chzn-results .group-result {
270
- cursor: default;
271
- color: #999;
272
- font-weight: bold;
273
- }
274
- .chzn-container .chzn-results .group-option {
275
- padding-left: 20px;
276
- }
277
- .chzn-container-multi .chzn-drop .result-selected {
278
- display: none;
279
- }
280
- /* @end */
281
-
282
- /* @group Active */
283
- .chzn-container-active .chzn-single {
284
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
285
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
286
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
287
- box-shadow : 0 0 5px rgba(0,0,0,.3);
288
- border: 1px solid #5897fb;
289
- }
290
- .chzn-container-active .chzn-single-with-drop {
291
- border: 1px solid #aaa;
292
- -webkit-box-shadow: 0 1px 0 #fff inset;
293
- -moz-box-shadow : 0 1px 0 #fff inset;
294
- -o-box-shadow : 0 1px 0 #fff inset;
295
- box-shadow : 0 1px 0 #fff inset;
296
- background-color: #eee;
297
- background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
298
- background-image: -webkit-linear-gradient(center bottom, white 0%, #eeeeee 50%);
299
- background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
300
- background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
301
- background-image: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 50%);
302
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 );
303
- background-image: linear-gradient(top, #ffffff 0%,#eeeeee 50%);
304
- -webkit-border-bottom-left-radius : 0;
305
- -webkit-border-bottom-right-radius: 0;
306
- -moz-border-radius-bottomleft : 0;
307
- -moz-border-radius-bottomright: 0;
308
- border-bottom-left-radius : 0;
309
- border-bottom-right-radius: 0;
310
- }
311
- .chzn-container-active .chzn-single-with-drop div {
312
- background: transparent;
313
- border-left: none;
314
- }
315
- .chzn-container-active .chzn-single-with-drop div b {
316
- background-position: -18px 1px;
317
- }
318
- .chzn-container-active .chzn-choices {
319
- -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3);
320
- -moz-box-shadow : 0 0 5px rgba(0,0,0,.3);
321
- -o-box-shadow : 0 0 5px rgba(0,0,0,.3);
322
- box-shadow : 0 0 5px rgba(0,0,0,.3);
323
- border: 1px solid #5897fb;
324
- }
325
- .chzn-container-active .chzn-choices .search-field input {
326
- color: #111 !important;
327
- }
328
- /* @end */
329
-
330
- /* @group Disabled Support */
331
- .chzn-disabled {
332
- cursor: default;
333
- opacity:0.5 !important;
334
- }
335
- .chzn-disabled .chzn-single {
336
- cursor: default;
337
- }
338
- .chzn-disabled .chzn-choices .search-choice .search-choice-close {
339
- cursor: default;
340
- }
341
-
342
- /* @group Right to Left */
343
- .chzn-rtl { direction:rtl;text-align: right; }
344
- .chzn-rtl .chzn-single { padding-left: 0; padding-right: 8px; }
345
- .chzn-rtl .chzn-single span { margin-left: 26px; margin-right: 0; }
346
- .chzn-rtl .chzn-single div {
347
- left: 0; right: auto;
348
- border-left: none; border-right: 1px solid #aaaaaa;
349
- -webkit-border-radius: 4px 0 0 4px;
350
- -moz-border-radius : 4px 0 0 4px;
351
- border-radius : 4px 0 0 4px;
352
- }
353
- .chzn-rtl .chzn-choices li { float: right; }
354
- .chzn-rtl .chzn-choices .search-choice { padding: 3px 6px 3px 19px; margin: 3px 5px 3px 0; }
355
- .chzn-rtl .chzn-choices .search-choice .search-choice-close { left: 5px; right: auto; background-position: right top;}
356
- .chzn-rtl.chzn-container-single .chzn-results { margin-left: 4px; margin-right: 0; padding-left: 0; padding-right: 4px; }
357
- .chzn-rtl .chzn-results .group-option { padding-left: 0; padding-right: 20px; }
358
- .chzn-rtl.chzn-container-active .chzn-single-with-drop div { border-right: none; }
359
- .chzn-rtl .chzn-search input {
360
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, #ffffff;
361
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
362
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -webkit-linear-gradient(center bottom, white 85%, #eeeeee 99%);
363
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
364
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
365
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
366
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, -ms-linear-gradient(top, #ffffff 85%,#eeeeee 99%);
367
- background: url('/assets/rollout_ui/chosen-sprite.png') no-repeat -38px -22px, linear-gradient(top, #ffffff 85%,#eeeeee 99%);
368
- padding: 4px 5px 4px 20px;
369
- }
370
- /* @end */
371
- :@compressedF:@created_atf1318830254.761096��
@@ -1,1015 +0,0 @@
1
- o: ActiveSupport::Cache::Entry :@expires_in0: @value{"asset_paths["U/web/rollout_ui/lib/rollout_ui/engine/vendor/assets/javascripts/chosen.jquery.js" body":�// Chosen, a Select Box Enhancer for jQuery and Protoype
2
- // by Patrick Filler for Harvest, http://getharvest.com
3
- //
4
- // Version 0.9.5
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
- var SelectParser;
12
- SelectParser = (function() {
13
- function SelectParser() {
14
- this.options_index = 0;
15
- this.parsed = [];
16
- }
17
- SelectParser.prototype.add_node = function(child) {
18
- if (child.nodeName === "OPTGROUP") {
19
- return this.add_group(child);
20
- } else {
21
- return this.add_option(child);
22
- }
23
- };
24
- SelectParser.prototype.add_group = function(group) {
25
- var group_position, option, _i, _len, _ref, _results;
26
- group_position = this.parsed.length;
27
- this.parsed.push({
28
- array_index: group_position,
29
- group: true,
30
- label: group.label,
31
- children: 0,
32
- disabled: group.disabled
33
- });
34
- _ref = group.childNodes;
35
- _results = [];
36
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
37
- option = _ref[_i];
38
- _results.push(this.add_option(option, group_position, group.disabled));
39
- }
40
- return _results;
41
- };
42
- SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
43
- if (option.nodeName === "OPTION") {
44
- if (option.text !== "") {
45
- if (group_position != null) {
46
- this.parsed[group_position].children += 1;
47
- }
48
- this.parsed.push({
49
- array_index: this.parsed.length,
50
- options_index: this.options_index,
51
- value: option.value,
52
- text: option.text,
53
- html: option.innerHTML,
54
- selected: option.selected,
55
- disabled: group_disabled === true ? group_disabled : option.disabled,
56
- group_array_index: group_position,
57
- classes: option.className,
58
- style: option.style.cssText
59
- });
60
- } else {
61
- this.parsed.push({
62
- array_index: this.parsed.length,
63
- options_index: this.options_index,
64
- empty: true
65
- });
66
- }
67
- return this.options_index += 1;
68
- }
69
- };
70
- return SelectParser;
71
- })();
72
- SelectParser.select_to_array = function(select) {
73
- var child, parser, _i, _len, _ref;
74
- parser = new SelectParser();
75
- _ref = select.childNodes;
76
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
77
- child = _ref[_i];
78
- parser.add_node(child);
79
- }
80
- return parser.parsed;
81
- };
82
- this.SelectParser = SelectParser;
83
- }).call(this);
84
- (function() {
85
- /*
86
- Chosen source: generate output using 'cake build'
87
- Copyright (c) 2011 by Harvest
88
- */
89
- var AbstractChosen, root;
90
- var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
91
- root = this;
92
- AbstractChosen = (function() {
93
- function AbstractChosen(form_field, options) {
94
- this.form_field = form_field;
95
- this.options = options != null ? options : {};
96
- this.set_default_values();
97
- this.is_multiple = this.form_field.multiple;
98
- this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
99
- this.setup();
100
- this.set_up_html();
101
- this.register_observers();
102
- this.finish_setup();
103
- }
104
- AbstractChosen.prototype.set_default_values = function() {
105
- this.click_test_action = __bind(function(evt) {
106
- return this.test_active_click(evt);
107
- }, this);
108
- this.activate_action = __bind(function(evt) {
109
- return this.activate_field(evt);
110
- }, this);
111
- this.active_field = false;
112
- this.mouse_on_container = false;
113
- this.results_showing = false;
114
- this.result_highlighted = null;
115
- this.result_single_selected = null;
116
- this.allow_single_deselect = (this.options.allow_single_deselect != null) && this.form_field.options[0].text === "" ? this.options.allow_single_deselect : false;
117
- this.disable_search_threshold = this.options.disable_search_threshold || 0;
118
- this.choices = 0;
119
- return this.results_none_found = this.options.no_results_text || "No results match";
120
- };
121
- AbstractChosen.prototype.mouse_enter = function() {
122
- return this.mouse_on_container = true;
123
- };
124
- AbstractChosen.prototype.mouse_leave = function() {
125
- return this.mouse_on_container = false;
126
- };
127
- AbstractChosen.prototype.input_focus = function(evt) {
128
- if (!this.active_field) {
129
- return setTimeout((__bind(function() {
130
- return this.container_mousedown();
131
- }, this)), 50);
132
- }
133
- };
134
- AbstractChosen.prototype.input_blur = function(evt) {
135
- if (!this.mouse_on_container) {
136
- this.active_field = false;
137
- return setTimeout((__bind(function() {
138
- return this.blur_test();
139
- }, this)), 100);
140
- }
141
- };
142
- AbstractChosen.prototype.result_add_option = function(option) {
143
- var classes, style;
144
- if (!option.disabled) {
145
- option.dom_id = this.container_id + "_o_" + option.array_index;
146
- classes = option.selected && this.is_multiple ? [] : ["active-result"];
147
- if (option.selected) {
148
- classes.push("result-selected");
149
- }
150
- if (option.group_array_index != null) {
151
- classes.push("group-option");
152
- }
153
- if (option.classes !== "") {
154
- classes.push(option.classes);
155
- }
156
- style = option.style.cssText !== "" ? " style=\"" + option.style + "\"" : "";
157
- return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '"' + style + '>' + option.html + '</li>';
158
- } else {
159
- return "";
160
- }
161
- };
162
- AbstractChosen.prototype.results_update_field = function() {
163
- this.result_clear_highlight();
164
- this.result_single_selected = null;
165
- return this.results_build();
166
- };
167
- AbstractChosen.prototype.results_toggle = function() {
168
- if (this.results_showing) {
169
- return this.results_hide();
170
- } else {
171
- return this.results_show();
172
- }
173
- };
174
- AbstractChosen.prototype.results_search = function(evt) {
175
- if (this.results_showing) {
176
- return this.winnow_results();
177
- } else {
178
- return this.results_show();
179
- }
180
- };
181
- AbstractChosen.prototype.keyup_checker = function(evt) {
182
- var stroke, _ref;
183
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
184
- this.search_field_scale();
185
- switch (stroke) {
186
- case 8:
187
- if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
188
- return this.keydown_backstroke();
189
- } else if (!this.pending_backstroke) {
190
- this.result_clear_highlight();
191
- return this.results_search();
192
- }
193
- break;
194
- case 13:
195
- evt.preventDefault();
196
- if (this.results_showing) {
197
- return this.result_select(evt);
198
- } else if (this.is_tag) {
199
- return this.choice_append();
200
- }
201
- break;
202
- case 27:
203
- if (this.results_showing) {
204
- return this.results_hide();
205
- }
206
- break;
207
- case 9:
208
- case 38:
209
- case 40:
210
- case 16:
211
- case 91:
212
- case 17:
213
- break;
214
- default:
215
- return this.results_search();
216
- }
217
- };
218
- AbstractChosen.prototype.generate_field_id = function() {
219
- var new_id;
220
- new_id = this.generate_random_id();
221
- this.form_field.id = new_id;
222
- return new_id;
223
- };
224
- AbstractChosen.prototype.generate_random_char = function() {
225
- var chars, newchar, rand;
226
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
227
- rand = Math.floor(Math.random() * chars.length);
228
- return newchar = chars.substring(rand, rand + 1);
229
- };
230
- return AbstractChosen;
231
- })();
232
- root.AbstractChosen = AbstractChosen;
233
- }).call(this);
234
- (function() {
235
- /*
236
- Chosen source: generate output using 'cake build'
237
- Copyright (c) 2011 by Harvest
238
- */
239
- var $, Chosen, get_side_border_padding, root;
240
- var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
241
- for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
242
- function ctor() { this.constructor = child; }
243
- ctor.prototype = parent.prototype;
244
- child.prototype = new ctor;
245
- child.__super__ = parent.prototype;
246
- return child;
247
- }, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
248
- root = this;
249
- $ = jQuery;
250
- $.fn.extend({
251
- chosen: function(options) {
252
- if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
253
- return this;
254
- }
255
- return $(this).each(function(input_field) {
256
- if (!($(this)).hasClass("chzn-done")) {
257
- return new Chosen(this, options);
258
- }
259
- });
260
- }
261
- });
262
- Chosen = (function() {
263
- __extends(Chosen, AbstractChosen);
264
- function Chosen() {
265
- Chosen.__super__.constructor.apply(this, arguments);
266
- }
267
- Chosen.prototype.setup = function() {
268
- var tag, tags, val, _i, _len, _results;
269
- this.form_field_jq = $(this.form_field);
270
- this.is_tag = this.form_field_jq.attr("type") === "text";
271
- this.is_multiple = this.is_tag ? true : this.is_multiple;
272
- this.default_text_default = this.is_tag ? "Enter Tags" : this.default_text_default;
273
- this.is_rtl = this.form_field_jq.hasClass("chzn-rtl");
274
- this.tags = [];
275
- if (this.is_tag) {
276
- val = this.form_field.value;
277
- this.form_field.value = '';
278
- if (val !== '') {
279
- tags = val.split(',');
280
- _results = [];
281
- for (_i = 0, _len = tags.length; _i < _len; _i++) {
282
- tag = tags[_i];
283
- _results.push(this.tags.push(unescape(tag)));
284
- }
285
- return _results;
286
- }
287
- }
288
- };
289
- Chosen.prototype.finish_setup = function() {
290
- var tag, _i, _len, _ref, _results;
291
- this.form_field_jq.addClass("chzn-done");
292
- _ref = this.tags;
293
- _results = [];
294
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
295
- tag = _ref[_i];
296
- _results.push(this.choice_append(tag, tag));
297
- }
298
- return _results;
299
- };
300
- Chosen.prototype.set_up_html = function() {
301
- var container_div, dd_top, dd_width, sf_width;
302
- this.container_id = this.form_field.id.length ? this.form_field.id.replace(/(:|\.)/g, '_') : this.generate_field_id();
303
- this.container_id += "_chzn";
304
- this.f_width = this.form_field_jq.outerWidth();
305
- this.default_text = this.form_field_jq.data('placeholder') ? this.form_field_jq.data('placeholder') : this.default_text_default;
306
- container_div = $("<div />", {
307
- id: this.container_id,
308
- "class": "chzn-container" + (this.is_rtl ? ' chzn-rtl' : ''),
309
- style: 'width: ' + this.f_width + 'px;'
310
- });
311
- if (this.is_multiple) {
312
- 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>');
313
- } else {
314
- 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>');
315
- }
316
- this.form_field_jq.hide().after(container_div);
317
- this.container = $('#' + this.container_id);
318
- this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
319
- if (!this.is_multiple && this.form_field.options.length <= this.disable_search_threshold) {
320
- this.container.addClass("chzn-container-single-nosearch");
321
- }
322
- this.dropdown = this.container.find('div.chzn-drop').first();
323
- dd_top = this.container.height();
324
- dd_width = this.f_width - get_side_border_padding(this.dropdown);
325
- this.dropdown.css({
326
- "width": dd_width + "px",
327
- "top": dd_top + "px"
328
- });
329
- this.search_field = this.container.find('input').first();
330
- this.search_results = this.container.find('ul.chzn-results').first();
331
- this.search_field_scale();
332
- this.search_no_results = this.container.find('li.no-results').first();
333
- if (this.is_multiple) {
334
- this.search_choices = this.container.find('ul.chzn-choices').first();
335
- this.search_container = this.container.find('li.search-field').first();
336
- } else {
337
- this.search_container = this.container.find('div.chzn-search').first();
338
- this.selected_item = this.container.find('.chzn-single').first();
339
- sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
340
- this.search_field.css({
341
- "width": sf_width + "px"
342
- });
343
- }
344
- if (this.is_tag) {
345
- this.container.prepend('<select id="' + this.container_id + '_shadow" name="' + this.form_field.name + '" style="display: none;" multiple="multiple"></select>');
346
- this.form_field_jq = $('#' + this.container_id + '_shadow');
347
- this.form_field = this.form_field_jq.get(0);
348
- }
349
- this.results_build();
350
- return this.set_tab_index();
351
- };
352
- Chosen.prototype.register_observers = function() {
353
- this.container.mousedown(__bind(function(evt) {
354
- return this.container_mousedown(evt);
355
- }, this));
356
- this.container.mouseup(__bind(function(evt) {
357
- return this.container_mouseup(evt);
358
- }, this));
359
- this.container.mouseenter(__bind(function(evt) {
360
- return this.mouse_enter(evt);
361
- }, this));
362
- this.container.mouseleave(__bind(function(evt) {
363
- return this.mouse_leave(evt);
364
- }, this));
365
- this.search_results.mouseup(__bind(function(evt) {
366
- return this.search_results_mouseup(evt);
367
- }, this));
368
- this.search_results.mouseover(__bind(function(evt) {
369
- return this.search_results_mouseover(evt);
370
- }, this));
371
- this.search_results.mouseout(__bind(function(evt) {
372
- return this.search_results_mouseout(evt);
373
- }, this));
374
- this.form_field_jq.bind("liszt:updated", __bind(function(evt) {
375
- return this.results_update_field(evt);
376
- }, this));
377
- this.search_field.blur(__bind(function(evt) {
378
- return this.input_blur(evt);
379
- }, this));
380
- this.search_field.keyup(__bind(function(evt) {
381
- return this.keyup_checker(evt);
382
- }, this));
383
- this.search_field.keydown(__bind(function(evt) {
384
- return this.keydown_checker(evt);
385
- }, this));
386
- if (this.is_multiple) {
387
- this.search_choices.click(__bind(function(evt) {
388
- return this.choices_click(evt);
389
- }, this));
390
- return this.search_field.focus(__bind(function(evt) {
391
- return this.input_focus(evt);
392
- }, this));
393
- }
394
- };
395
- Chosen.prototype.search_field_disabled = function() {
396
- this.is_disabled = this.form_field_jq.attr('disabled');
397
- if (this.is_disabled) {
398
- this.container.addClass('chzn-disabled');
399
- this.search_field.attr('disabled', true);
400
- if (!this.is_multiple) {
401
- this.selected_item.unbind("focus", this.activate_action);
402
- }
403
- return this.close_field();
404
- } else {
405
- this.container.removeClass('chzn-disabled');
406
- this.search_field.attr('disabled', false);
407
- if (!this.is_multiple) {
408
- return this.selected_item.bind("focus", this.activate_action);
409
- }
410
- }
411
- };
412
- Chosen.prototype.container_mousedown = function(evt) {
413
- var target_closelink;
414
- if (!this.is_disabled) {
415
- target_closelink = evt != null ? ($(evt.target)).hasClass("search-choice-close") : false;
416
- if (evt && evt.type === "mousedown") {
417
- evt.stopPropagation();
418
- }
419
- if (!this.pending_destroy_click && !target_closelink) {
420
- if (!this.active_field) {
421
- if (this.is_multiple) {
422
- this.search_field.val("");
423
- }
424
- $(document).click(this.click_test_action);
425
- this.results_show();
426
- } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
427
- evt.preventDefault();
428
- this.results_toggle();
429
- }
430
- return this.activate_field();
431
- } else {
432
- return this.pending_destroy_click = false;
433
- }
434
- }
435
- };
436
- Chosen.prototype.container_mouseup = function(evt) {
437
- if (evt.target.nodeName === "ABBR") {
438
- return this.results_reset(evt);
439
- }
440
- };
441
- Chosen.prototype.blur_test = function(evt) {
442
- if (!this.active_field && this.container.hasClass("chzn-container-active")) {
443
- return this.close_field();
444
- }
445
- };
446
- Chosen.prototype.close_field = function() {
447
- $(document).unbind("click", this.click_test_action);
448
- if (!this.is_multiple) {
449
- this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
450
- this.search_field.attr("tabindex", -1);
451
- }
452
- this.active_field = false;
453
- this.results_hide();
454
- this.container.removeClass("chzn-container-active");
455
- this.winnow_results_clear();
456
- this.clear_backstroke();
457
- this.show_search_field_default();
458
- return this.search_field_scale();
459
- };
460
- Chosen.prototype.activate_field = function() {
461
- if (!this.is_multiple && !this.active_field) {
462
- this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
463
- this.selected_item.attr("tabindex", -1);
464
- }
465
- this.container.addClass("chzn-container-active");
466
- this.active_field = true;
467
- this.search_field.val(this.search_field.val());
468
- return this.search_field.focus();
469
- };
470
- Chosen.prototype.test_active_click = function(evt) {
471
- if ($(evt.target).parents('#' + this.container_id).length) {
472
- return this.active_field = true;
473
- } else {
474
- return this.close_field();
475
- }
476
- };
477
- Chosen.prototype.results_build = function() {
478
- var content, data, hash, i, opt, result, startTime, _i, _j, _len, _len2, _len3, _ref, _ref2;
479
- startTime = new Date();
480
- this.parsing = true;
481
- if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
482
- hash = {};
483
- _ref = this.form_field.options;
484
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
485
- opt = _ref[_i];
486
- if (opt.selected) {
487
- hash[opt.value] = true;
488
- }
489
- }
490
- this.results_data = [];
491
- for (i = 0, _len2 = results.length; i < _len2; i++) {
492
- result = results[i];
493
- this.results_data.push({
494
- array_index: i,
495
- options_index: i,
496
- value: result.value,
497
- text: result.text,
498
- html: result.text,
499
- selected: result.value in hash ? 1 : 0,
500
- disabled: 0,
501
- group_array_index: null
502
- });
503
- }
504
- } else {
505
- this.results_data = root.SelectParser.select_to_array(this.form_field);
506
- if (this.is_multiple && this.choices > 0) {
507
- this.search_choices.find("li.search-choice").remove();
508
- this.choices = 0;
509
- } else if (!this.is_multiple) {
510
- this.selected_item.find("span").text(this.default_text);
511
- }
512
- }
513
- content = '';
514
- _ref2 = this.results_data;
515
- for (_j = 0, _len3 = _ref2.length; _j < _len3; _j++) {
516
- data = _ref2[_j];
517
- if (data.group) {
518
- content += this.result_add_group(data);
519
- } else if (!data.empty) {
520
- content += this.result_add_option(data);
521
- if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
522
- continue;
523
- }
524
- if (data.selected && this.is_multiple) {
525
- this.choice_build(data);
526
- } else if (data.selected && !this.is_multiple) {
527
- this.selected_item.find("span").text(data.text);
528
- if (this.allow_single_deselect) {
529
- this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
530
- }
531
- }
532
- }
533
- }
534
- if (this.is_tag && (typeof results !== "undefined" && results !== null)) {
535
- this.search_results.html(content);
536
- this.results_show();
537
- } else {
538
- this.search_field_disabled();
539
- this.show_search_field_default();
540
- this.search_field_scale();
541
- this.search_results.html(content);
542
- }
543
- return this.parsing = false;
544
- };
545
- Chosen.prototype.result_add_group = function(group) {
546
- if (!group.disabled) {
547
- group.dom_id = this.container_id + "_g_" + group.array_index;
548
- return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
549
- } else {
550
- return "";
551
- }
552
- };
553
- Chosen.prototype.result_do_highlight = function(el) {
554
- var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
555
- if (el.length) {
556
- this.result_clear_highlight();
557
- this.result_highlight = el;
558
- this.result_highlight.addClass("highlighted");
559
- maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
560
- visible_top = this.search_results.scrollTop();
561
- visible_bottom = maxHeight + visible_top;
562
- high_top = this.result_highlight.position().top + this.search_results.scrollTop();
563
- high_bottom = high_top + this.result_highlight.outerHeight();
564
- if (high_bottom >= visible_bottom) {
565
- return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
566
- } else if (high_top < visible_top) {
567
- return this.search_results.scrollTop(high_top);
568
- }
569
- }
570
- };
571
- Chosen.prototype.result_clear_highlight = function() {
572
- if (this.result_highlight) {
573
- this.result_highlight.removeClass("highlighted");
574
- }
575
- return this.result_highlight = null;
576
- };
577
- Chosen.prototype.results_show = function() {
578
- var dd_top;
579
- if (!this.is_multiple) {
580
- this.selected_item.addClass("chzn-single-with-drop");
581
- if (this.result_single_selected) {
582
- this.result_do_highlight(this.result_single_selected);
583
- }
584
- }
585
- dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
586
- this.dropdown.css({
587
- "top": dd_top + "px",
588
- "left": 0
589
- });
590
- this.results_showing = true;
591
- this.search_field.focus();
592
- this.search_field.val(this.search_field.val());
593
- return this.winnow_results();
594
- };
595
- Chosen.prototype.results_hide = function() {
596
- if (!this.is_multiple) {
597
- this.selected_item.removeClass("chzn-single-with-drop");
598
- }
599
- this.result_clear_highlight();
600
- this.dropdown.css({
601
- "left": "-9000px"
602
- });
603
- return this.results_showing = false;
604
- };
605
- Chosen.prototype.set_tab_index = function(el) {
606
- var ti;
607
- if (this.form_field_jq.attr("tabindex")) {
608
- ti = this.form_field_jq.attr("tabindex");
609
- this.form_field_jq.attr("tabindex", -1);
610
- if (this.is_multiple) {
611
- return this.search_field.attr("tabindex", ti);
612
- } else {
613
- this.selected_item.attr("tabindex", ti);
614
- return this.search_field.attr("tabindex", -1);
615
- }
616
- }
617
- };
618
- Chosen.prototype.show_search_field_default = function() {
619
- if (this.is_multiple && this.choices < 1 && !this.active_field) {
620
- this.search_field.val(this.default_text);
621
- return this.search_field.addClass("default");
622
- } else {
623
- this.search_field.val("");
624
- return this.search_field.removeClass("default");
625
- }
626
- };
627
- Chosen.prototype.search_results_mouseup = function(evt) {
628
- var target;
629
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
630
- if (target.length) {
631
- this.result_highlight = target;
632
- return this.result_select(evt);
633
- }
634
- };
635
- Chosen.prototype.search_results_mouseover = function(evt) {
636
- var target;
637
- target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
638
- if (target) {
639
- return this.result_do_highlight(target);
640
- }
641
- };
642
- Chosen.prototype.search_results_mouseout = function(evt) {
643
- if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
644
- return this.result_clear_highlight();
645
- }
646
- };
647
- Chosen.prototype.choices_click = function(evt) {
648
- evt.preventDefault();
649
- if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
650
- return this.results_show();
651
- }
652
- };
653
- Chosen.prototype.choice_append = function(text, value) {
654
- var i, item, opt, result, txt, val, _i, _len, _len2, _ref, _ref2;
655
- txt = text != null ? text : $.trim(this.search_field.val());
656
- val = value != null ? value : txt;
657
- if (txt.length < 1 || val.length < 1) {
658
- return this.results_hide();
659
- }
660
- _ref = this.form_field.options;
661
- for (i = 0, _len = _ref.length; i < _len; i++) {
662
- opt = _ref[i];
663
- if (opt.value === val) {
664
- if (opt.selected) {
665
- return this.results_hide();
666
- } else {
667
- break;
668
- }
669
- }
670
- }
671
- _ref2 = this.results_data;
672
- for (_i = 0, _len2 = _ref2.length; _i < _len2; _i++) {
673
- result = _ref2[_i];
674
- if (result.value === val) {
675
- result.selected = true;
676
- break;
677
- }
678
- }
679
- if (i === this.form_field.length) {
680
- this.form_field.options[i] = new Option(txt, val);
681
- }
682
- this.form_field.options[i].selected = true;
683
- item = {
684
- array_index: i,
685
- options_index: i,
686
- value: val,
687
- text: txt,
688
- html: txt,
689
- selected: 1,
690
- disabled: 0,
691
- group_array_index: null
692
- };
693
- this.choice_build(item);
694
- this.results_hide();
695
- this.search_field.val("");
696
- this.form_field_jq.trigger("change");
697
- return this.search_field_scale();
698
- };
699
- Chosen.prototype.choice_build = function(item) {
700
- var choice_id, link;
701
- choice_id = this.container_id + "_c_" + item.array_index;
702
- this.choices += 1;
703
- 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>');
704
- link = $('#' + choice_id).find("a").first();
705
- return link.click(__bind(function(evt) {
706
- return this.choice_destroy_link_click(evt);
707
- }, this));
708
- };
709
- Chosen.prototype.choice_destroy_link_click = function(evt) {
710
- evt.preventDefault();
711
- if (!this.is_disabled) {
712
- this.pending_destroy_click = true;
713
- return this.choice_destroy($(evt.target));
714
- } else {
715
- return evt.stopPropagation;
716
- }
717
- };
718
- Chosen.prototype.choice_destroy = function(link) {
719
- this.choices -= 1;
720
- this.show_search_field_default();
721
- if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
722
- this.results_hide();
723
- }
724
- this.result_deselect(link.attr("rel"));
725
- return link.parents('li').first().remove();
726
- };
727
- Chosen.prototype.results_reset = function(evt) {
728
- this.form_field.options[0].selected = true;
729
- this.selected_item.find("span").text(this.default_text);
730
- this.show_search_field_default();
731
- $(evt.target).remove();
732
- this.form_field_jq.trigger("change");
733
- if (this.active_field) {
734
- return this.results_hide();
735
- }
736
- };
737
- Chosen.prototype.result_select = function(evt) {
738
- var high, high_id, item, position;
739
- if (this.result_highlight) {
740
- high = this.result_highlight;
741
- high_id = high.attr("id");
742
- this.result_clear_highlight();
743
- if (this.is_multiple) {
744
- this.result_deactivate(high);
745
- } else {
746
- this.search_results.find(".result-selected").removeClass("result-selected");
747
- this.result_single_selected = high;
748
- }
749
- high.addClass("result-selected");
750
- position = high_id.substr(high_id.lastIndexOf("_") + 1);
751
- item = this.results_data[position];
752
- item.selected = true;
753
- if (this.is_tag) {
754
- this.choice_append(item.text, item.value);
755
- } else {
756
- this.form_field.options[item.options_index].selected = true;
757
- if (this.is_multiple) {
758
- this.choice_build(item);
759
- } else {
760
- this.selected_item.find("span").first().text(item.text);
761
- if (this.allow_single_deselect) {
762
- this.selected_item.find("span").first().after("<abbr class=\"search-choice-close\"></abbr>");
763
- }
764
- }
765
- }
766
- if (!(evt.metaKey && this.is_multiple)) {
767
- this.results_hide();
768
- }
769
- this.search_field.val("");
770
- this.form_field_jq.trigger("change");
771
- return this.search_field_scale();
772
- }
773
- };
774
- Chosen.prototype.result_activate = function(el) {
775
- return el.addClass("active-result");
776
- };
777
- Chosen.prototype.result_deactivate = function(el) {
778
- return el.removeClass("active-result");
779
- };
780
- Chosen.prototype.result_deselect = function(pos) {
781
- var result, result_data;
782
- if (this.is_tag) {
783
- this.form_field.options[pos].selected = false;
784
- } else {
785
- result_data = this.results_data[pos];
786
- result_data.selected = false;
787
- this.form_field.options[result_data.options_index].selected = false;
788
- }
789
- result = $("#" + this.container_id + "_o_" + pos);
790
- result.removeClass("result-selected").addClass("active-result").show();
791
- this.result_clear_highlight();
792
- this.winnow_results();
793
- this.form_field_jq.trigger("change");
794
- return this.search_field_scale();
795
- };
796
- Chosen.prototype.winnow_results = function() {
797
- var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
798
- startTime = new Date();
799
- this.no_results_clear();
800
- results = 0;
801
- searchText = this.search_field.val() === this.default_text ? "" : $('<div/>').text($.trim(this.search_field.val())).html();
802
- regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
803
- zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
804
- _ref = this.results_data;
805
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
806
- option = _ref[_i];
807
- if (!option.disabled && !option.empty) {
808
- if (option.group) {
809
- $('#' + option.dom_id).hide();
810
- } else if (!(this.is_multiple && option.selected)) {
811
- found = false;
812
- result_id = option.dom_id;
813
- if (regex.test(option.html)) {
814
- found = true;
815
- results += 1;
816
- } else if (option.html.indexOf(" ") >= 0 || option.html.indexOf("[") === 0) {
817
- parts = option.html.replace(/\[|\]/g, "").split(" ");
818
- if (parts.length) {
819
- for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
820
- part = parts[_j];
821
- if (regex.test(part)) {
822
- found = true;
823
- results += 1;
824
- }
825
- }
826
- }
827
- }
828
- if (found) {
829
- if (searchText.length) {
830
- startpos = option.html.search(zregex);
831
- text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length);
832
- text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
833
- } else {
834
- text = option.html;
835
- }
836
- if ($("#" + result_id).html !== text) {
837
- $("#" + result_id).html(text);
838
- }
839
- this.result_activate($("#" + result_id));
840
- if (option.group_array_index != null) {
841
- $("#" + this.results_data[option.group_array_index].dom_id).show();
842
- }
843
- } else {
844
- if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
845
- this.result_clear_highlight();
846
- }
847
- this.result_deactivate($("#" + result_id));
848
- }
849
- }
850
- }
851
- }
852
- if (results < 1 && searchText.length) {
853
- return this.no_results(searchText);
854
- } else {
855
- return this.winnow_results_set_highlight();
856
- }
857
- };
858
- Chosen.prototype.winnow_results_clear = function() {
859
- var li, lis, _i, _len, _results;
860
- this.search_field.val("");
861
- lis = this.search_results.find("li");
862
- _results = [];
863
- for (_i = 0, _len = lis.length; _i < _len; _i++) {
864
- li = lis[_i];
865
- li = $(li);
866
- _results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
867
- }
868
- return _results;
869
- };
870
- Chosen.prototype.winnow_results_set_highlight = function() {
871
- var do_high, selected_results;
872
- if (!this.result_highlight) {
873
- selected_results = !this.is_multiple ? this.search_results.find(".result-selected.active-result") : [];
874
- do_high = selected_results.length ? selected_results.first() : this.search_results.find(".active-result").first();
875
- if (do_high != null) {
876
- return this.result_do_highlight(do_high);
877
- }
878
- }
879
- };
880
- Chosen.prototype.no_results = function(terms) {
881
- var no_results_html;
882
- if (this.is_tag) {
883
- return this.results_hide();
884
- }
885
- no_results_html = $('<li class="no-results">' + this.results_none_found + ' "<span></span>"</li>');
886
- no_results_html.find("span").first().html(terms);
887
- return this.search_results.append(no_results_html);
888
- };
889
- Chosen.prototype.no_results_clear = function() {
890
- return this.search_results.find(".no-results").remove();
891
- };
892
- Chosen.prototype.keydown_arrow = function() {
893
- var first_active, next_sib;
894
- if (!this.result_highlight) {
895
- first_active = this.search_results.find("li.active-result").first();
896
- if (first_active) {
897
- this.result_do_highlight($(first_active));
898
- }
899
- } else if (this.results_showing) {
900
- next_sib = this.result_highlight.nextAll("li.active-result").first();
901
- if (next_sib) {
902
- this.result_do_highlight(next_sib);
903
- }
904
- }
905
- if (!this.results_showing) {
906
- return this.results_show();
907
- }
908
- };
909
- Chosen.prototype.keyup_arrow = function() {
910
- var prev_sibs;
911
- if (!this.results_showing && !this.is_multiple) {
912
- return this.results_show();
913
- } else if (this.result_highlight) {
914
- prev_sibs = this.result_highlight.prevAll("li.active-result");
915
- if (prev_sibs.length) {
916
- return this.result_do_highlight(prev_sibs.first());
917
- } else {
918
- if (this.choices > 0) {
919
- this.results_hide();
920
- }
921
- return this.result_clear_highlight();
922
- }
923
- }
924
- };
925
- Chosen.prototype.keydown_backstroke = function() {
926
- if (this.pending_backstroke) {
927
- this.choice_destroy(this.pending_backstroke.find("a").first());
928
- return this.clear_backstroke();
929
- } else {
930
- this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
931
- return this.pending_backstroke.addClass("search-choice-focus");
932
- }
933
- };
934
- Chosen.prototype.clear_backstroke = function() {
935
- if (this.pending_backstroke) {
936
- this.pending_backstroke.removeClass("search-choice-focus");
937
- }
938
- return this.pending_backstroke = null;
939
- };
940
- Chosen.prototype.keydown_checker = function(evt) {
941
- var stroke, _ref;
942
- stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
943
- this.search_field_scale();
944
- if (stroke !== 8 && this.pending_backstroke) {
945
- this.clear_backstroke();
946
- }
947
- switch (stroke) {
948
- case 8:
949
- this.backstroke_length = this.search_field.val().length;
950
- break;
951
- case 9:
952
- this.mouse_on_container = false;
953
- break;
954
- case 13:
955
- evt.preventDefault();
956
- break;
957
- case 38:
958
- evt.preventDefault();
959
- this.keyup_arrow();
960
- break;
961
- case 40:
962
- this.keydown_arrow();
963
- break;
964
- }
965
- };
966
- Chosen.prototype.search_field_scale = function() {
967
- var dd_top, div, h, style, style_block, styles, w, _i, _len;
968
- if (this.is_multiple) {
969
- h = 0;
970
- w = 0;
971
- style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
972
- styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
973
- for (_i = 0, _len = styles.length; _i < _len; _i++) {
974
- style = styles[_i];
975
- style_block += style + ":" + this.search_field.css(style) + ";";
976
- }
977
- div = $('<div />', {
978
- 'style': style_block
979
- });
980
- div.text(this.search_field.val());
981
- $('body').append(div);
982
- w = div.width() + 25;
983
- div.remove();
984
- if (w > this.f_width - 10) {
985
- w = this.f_width - 10;
986
- }
987
- this.search_field.css({
988
- 'width': w + 'px'
989
- });
990
- dd_top = this.container.height();
991
- return this.dropdown.css({
992
- "top": dd_top + "px"
993
- });
994
- }
995
- };
996
- Chosen.prototype.generate_random_id = function() {
997
- var string;
998
- string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char();
999
- while ($("#" + string).length > 0) {
1000
- string += this.generate_random_char();
1001
- }
1002
- return string;
1003
- };
1004
- return Chosen;
1005
- })();
1006
- get_side_border_padding = function(elmt) {
1007
- var side_border_padding;
1008
- return side_border_padding = elmt.outerWidth() - elmt.width();
1009
- };
1010
- root.get_side_border_padding = get_side_border_padding;
1011
- }).call(this);
1012
- "content_type"application/javascript"
1013
- class"BundledAsset"
1014
- mtime"2011-10-16T23:48:34-04:00"
1015
- mtimeu: Time