chosen-rails 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a32fb00872ecb69436db4a92a31779096517bff1
4
- data.tar.gz: f31803b1c81d6438de864a8d8e1a3dc03167df56
3
+ metadata.gz: ad66d71162136204ed73e3c857e02c9e00500e88
4
+ data.tar.gz: c085f626780bd1706795bfe8e6b65ae4280de151
5
5
  SHA512:
6
- metadata.gz: 7d3f9452482557374dad4d67089b70eae5174b970f33102fe445903ae5f2317e2d9aa9bd61be96a2cc73cd0ac4bf31d1faa74e9799c21b0e2a1a59f8044e18f4
7
- data.tar.gz: c68dfb92a883c6092dc53a1a9c098430b40d978b59c9ec3adf01e6a7c8855d0d9b27dd18a7c2c1d77b9b21e52a92e9f1ba2528e4d3927a055ad8cf31588b1be9
6
+ metadata.gz: 81c8187eba3ba107e464e8fb4f7f5e4dfa75da9d1bfc0e5c5e055cbb54cb8c4d2d96fc91497405415a39d9dc875165d62851a9ef675167cb8514662e7c4cc01f
7
+ data.tar.gz: 5a3425b486c0dc90608c7b7dc3c7bef1a95578837bc8067b941a855c796a9215c2c9425f3708567331f1b77984940c34dcdb48b7e563a1582c4613f6fc9508fb
data/README.md CHANGED
@@ -64,6 +64,10 @@ If you use simple form as form builder
64
64
  input_html: { class: 'chzn-select' }
65
65
  %>
66
66
 
67
+ ### Deployment
68
+
69
+ Since version 0.13.0, non-digested assets of `chosen-rails` will simply be copied from digested assets.
70
+
67
71
  ## Gem maintenance
68
72
 
69
73
  Maintain `chosen-rails` gem with `Rake` commands.
data/Rakefile CHANGED
@@ -8,6 +8,5 @@ task 'update-chosen', 'remote', 'branch' do |task, args|
8
8
  branch = args['branch'] || 'master'
9
9
  files = SourceFile.new
10
10
  files.fetch remote, branch
11
- files.convert
12
11
  files.cleanup
13
12
  end
data/chosen-rails.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency 'railties', '>= 3.0'
19
19
  gem.add_dependency 'coffee-rails', '>= 3.2'
20
20
  gem.add_dependency 'sass-rails', '>= 3.2'
21
+ gem.add_dependency 'compass-rails', '>= 1.0'
21
22
 
22
23
  gem.add_development_dependency 'bundler', '>= 1.0'
23
24
  gem.add_development_dependency 'rails', '>= 3.0'
@@ -4,6 +4,10 @@ module Chosen
4
4
  config.assets.precompile += %w(
5
5
  chosen-sprite*.png
6
6
  )
7
+
8
+ rake_tasks do
9
+ load 'chosen-rails/tasks.rake'
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -9,7 +9,7 @@ class SourceFile < Thor
9
9
  self.destination_root = 'vendor/assets'
10
10
  get "#{remote}/raw/#{branch}/public/chosen-sprite.png", 'images/chosen-sprite.png'
11
11
  get "#{remote}/raw/#{branch}/public/chosen-sprite@2x.png", 'images/chosen-sprite@2x.png'
12
- get "#{remote}/raw/#{branch}/public/chosen.css", 'stylesheets/chosen.css'
12
+ get "#{remote}/raw/#{branch}/sass/chosen.scss", 'stylesheets/chosen.css.scss'
13
13
  get "#{remote}/raw/#{branch}/coffee/lib/abstract-chosen.coffee", 'javascripts/lib/abstract-chosen.coffee'
14
14
  get "#{remote}/raw/#{branch}/coffee/lib/select-parser.coffee", 'javascripts/lib/select-parser.coffee'
15
15
  get "#{remote}/raw/#{branch}/coffee/chosen.jquery.coffee", 'javascripts/chosen.jquery.coffee'
@@ -18,21 +18,9 @@ class SourceFile < Thor
18
18
  bump_version
19
19
  end
20
20
 
21
- desc 'convert css to sass file', 'convert css to sass file by sass-convert'
22
- def convert
23
- self.destination_root = 'vendor/assets'
24
- inside destination_root do
25
- run('sass-convert -F css -T sass stylesheets/chosen.css stylesheets/chosen.css.sass')
26
- gsub_file 'stylesheets/chosen.css.sass', '(chosen-sprite.png)', "('chosen-sprite.png')"
27
- gsub_file 'stylesheets/chosen.css.sass', '(chosen-sprite@2x.png)', "('chosen-sprite@2x.png')"
28
- gsub_file 'stylesheets/chosen.css.sass', ' url', ' image-url'
29
- end
30
- end
31
-
32
21
  desc 'clean up useless files', 'clean up useless files'
33
22
  def cleanup
34
23
  self.destination_root = 'vendor/assets'
35
- remove_file 'stylesheets/chosen.css'
36
24
  remove_file 'package.json'
37
25
  end
38
26
 
@@ -0,0 +1,11 @@
1
+ require 'fileutils'
2
+
3
+ desc 'Create nondigest versions of all chosen digest assets'
4
+ task 'assets:precompile' do
5
+ fingerprint = /\-[0-9a-f]{32}\./
6
+ Dir['public/assets/chosen-*'].each do |file|
7
+ next unless file =~ fingerprint
8
+ nondigest = file.sub fingerprint, '.'
9
+ FileUtils.cp file, nondigest, verbose: true
10
+ end
11
+ end
@@ -1,6 +1,6 @@
1
1
  module Chosen
2
2
  module Rails
3
- VERSION = '0.12.0'
4
- CHOSEN_VERSION = '0.12.0'
3
+ VERSION = '0.13.0'
4
+ CHOSEN_VERSION = '0.13.0'
5
5
  end
6
6
  end
@@ -23,20 +23,18 @@ class Chosen extends AbstractChosen
23
23
  @form_field_jq.addClass "chzn-done"
24
24
 
25
25
  set_up_html: ->
26
- @container_id = if @form_field.id.length then @form_field.id.replace(/[^\w]/g, '_') else this.generate_field_id()
27
- @container_id += "_chzn"
28
-
29
26
  container_classes = ["chzn-container"]
30
27
  container_classes.push "chzn-container-" + (if @is_multiple then "multi" else "single")
31
28
  container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
32
29
  container_classes.push "chzn-rtl" if @is_rtl
33
30
 
34
31
  container_props =
35
- 'id': @container_id
36
32
  'class': container_classes.join ' '
37
33
  'style': "width: #{this.container_width()};"
38
34
  'title': @form_field.title
39
35
 
36
+ container_props.id = @form_field.id.replace(/[^\w]/g, '_') + "_chzn" if @form_field.id.length
37
+
40
38
  @container = ($ "<div />", container_props)
41
39
 
42
40
  if @is_multiple
@@ -152,7 +150,7 @@ class Chosen extends AbstractChosen
152
150
 
153
151
 
154
152
  test_active_click: (evt) ->
155
- if $(evt.target).parents('#' + @container_id).length
153
+ if @container.is($(evt.target).closest('.chzn-container'))
156
154
  @active_field = true
157
155
  else
158
156
  this.close_field()
@@ -182,10 +180,6 @@ class Chosen extends AbstractChosen
182
180
 
183
181
  @parsing = false
184
182
 
185
- result_add_group: (group) ->
186
- group.dom_id = @container_id + "_g_" + group.array_index
187
- '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>'
188
-
189
183
  result_do_highlight: (el) ->
190
184
  if el.length
191
185
  this.result_clear_highlight()
@@ -316,7 +310,6 @@ class Chosen extends AbstractChosen
316
310
  result_select: (evt) ->
317
311
  if @result_highlight
318
312
  high = @result_highlight
319
- high_id = high.attr "id"
320
313
 
321
314
  this.result_clear_highlight()
322
315
 
@@ -332,8 +325,7 @@ class Chosen extends AbstractChosen
332
325
 
333
326
  high.addClass "result-selected"
334
327
 
335
- position = high_id.substr(high_id.lastIndexOf("_") + 1 )
336
- item = @results_data[position]
328
+ item = @results_data[ high[0].getAttribute("data-option-array-index") ]
337
329
  item.selected = true
338
330
 
339
331
  @form_field.options[item.options_index].selected = true
@@ -370,9 +362,6 @@ class Chosen extends AbstractChosen
370
362
  @form_field.options[result_data.options_index].selected = false
371
363
  @selected_option_count = null
372
364
 
373
- result = $("#" + @container_id + "_o_" + pos)
374
- result.removeClass("result-selected").addClass("active-result").show()
375
-
376
365
  this.result_clear_highlight()
377
366
  this.winnow_results() if @results_showing
378
367
 
@@ -487,17 +476,11 @@ class Chosen extends AbstractChosen
487
476
  w = div.width() + 25
488
477
  div.remove()
489
478
 
490
- @f_width = @container.outerWidth() unless @f_width
479
+ f_width = @container.outerWidth()
491
480
 
492
- if( w > @f_width-10 )
493
- w = @f_width - 10
481
+ if( w > f_width - 10 )
482
+ w = f_width - 10
494
483
 
495
484
  @search_field.css({'width': w + 'px'})
496
-
497
- generate_random_id: ->
498
- string = "sel" + this.generate_random_char() + this.generate_random_char() + this.generate_random_char()
499
- while $("#" + string).length > 0
500
- string += this.generate_random_char()
501
- string
502
485
 
503
486
  root.Chosen = Chosen
@@ -18,19 +18,18 @@ class Chosen extends AbstractChosen
18
18
  @no_results_temp = new Template('<li class="no-results">' + @results_none_found + ' "<span>#{terms}</span>"</li>')
19
19
 
20
20
  set_up_html: ->
21
- @container_id = @form_field.identify().replace(/[^\w]/g, '_') + "_chzn"
22
-
23
21
  container_classes = ["chzn-container"]
24
22
  container_classes.push "chzn-container-" + (if @is_multiple then "multi" else "single")
25
23
  container_classes.push @form_field.className if @inherit_select_classes && @form_field.className
26
24
  container_classes.push "chzn-rtl" if @is_rtl
27
25
 
28
26
  container_props =
29
- 'id': @container_id
30
27
  'class': container_classes.join ' '
31
28
  'style': "width: #{this.container_width()};"
32
29
  'title': @form_field.title
33
30
 
31
+ container_props.id = @form_field.id.replace(/[^\w]/g, '_') + "_chzn" if @form_field.id.length
32
+
34
33
  @container = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
35
34
 
36
35
  @form_field.hide().insert({ after: @container })
@@ -140,7 +139,7 @@ class Chosen extends AbstractChosen
140
139
  @search_field.focus()
141
140
 
142
141
  test_active_click: (evt) ->
143
- if evt.target.up('#' + @container_id)
142
+ if evt.target.up('.chzn-container') is @container
144
143
  @active_field = true
145
144
  else
146
145
  this.close_field()
@@ -170,10 +169,6 @@ class Chosen extends AbstractChosen
170
169
 
171
170
  @parsing = false
172
171
 
173
- result_add_group: (group) ->
174
- group.dom_id = @container_id + "_g_" + group.array_index
175
- '<li id="' + group.dom_id + '" class="group-result">' + group.label.escapeHTML() + '</li>'
176
-
177
172
  result_do_highlight: (el) ->
178
173
  this.result_clear_highlight()
179
174
 
@@ -318,8 +313,7 @@ class Chosen extends AbstractChosen
318
313
 
319
314
  high.addClassName("result-selected")
320
315
 
321
- position = high.id.substr(high.id.lastIndexOf("_") + 1 )
322
- item = @results_data[position]
316
+ item = @results_data[ high.getAttribute("data-option-array-index") ]
323
317
  item.selected = true
324
318
 
325
319
  @form_field.options[item.options_index].selected = true
@@ -357,9 +351,6 @@ class Chosen extends AbstractChosen
357
351
  @form_field.options[result_data.options_index].selected = false
358
352
  @selected_option_count = null
359
353
 
360
- result = $(@container_id + "_o_" + pos)
361
- result.removeClassName("result-selected").addClassName("active-result").show()
362
-
363
354
  this.result_clear_highlight()
364
355
  this.winnow_results() if @results_showing
365
356
 
@@ -476,10 +467,10 @@ class Chosen extends AbstractChosen
476
467
  w = Element.measure(div, 'width') + 25
477
468
  div.remove()
478
469
 
479
- @f_width = @container.getWidth() unless @f_width
470
+ f_width = @container.getWidth()
480
471
 
481
- if( w > @f_width-10 )
482
- w = @f_width - 10
472
+ if( w > f_width-10 )
473
+ w = f_width - 10
483
474
 
484
475
  @search_field.setStyle({'width': w + 'px'})
485
476
 
@@ -27,8 +27,9 @@ class AbstractChosen
27
27
  @disable_search_threshold = @options.disable_search_threshold || 0
28
28
  @disable_search = @options.disable_search || false
29
29
  @enable_split_word_search = if @options.enable_split_word_search? then @options.enable_split_word_search else true
30
+ @group_search = if @options.group_search? then @options.group_search else true
30
31
  @search_contains = @options.search_contains || false
31
- @single_backstroke_delete = @options.single_backstroke_delete || false
32
+ @single_backstroke_delete = if @options.single_backstroke_delete? then @options.single_backstroke_delete else true
32
33
  @max_selected_options = @options.max_selected_options || Infinity
33
34
  @inherit_select_classes = @options.inherit_select_classes || false
34
35
 
@@ -50,7 +51,7 @@ class AbstractChosen
50
51
  setTimeout (=> this.container_mousedown()), 50 unless @active_field
51
52
  else
52
53
  @activate_field() unless @active_field
53
-
54
+
54
55
  input_blur: (evt) ->
55
56
  if not @mouse_on_container
56
57
  @active_field = false
@@ -59,7 +60,7 @@ class AbstractChosen
59
60
  results_option_build: (options) ->
60
61
  content = ''
61
62
  for data in @results_data
62
- if data.group && data.search_match
63
+ if data.group && (data.search_match || data.group_match)
63
64
  content += this.result_add_group data
64
65
  else if !data.empty && data.search_match
65
66
  content += this.result_add_option data
@@ -75,8 +76,6 @@ class AbstractChosen
75
76
  content
76
77
 
77
78
  result_add_option: (option) ->
78
- option.dom_id = @container_id + "_o_" + option.array_index
79
-
80
79
  classes = []
81
80
  classes.push "active-result" if !option.disabled and !(option.selected and @is_multiple)
82
81
  classes.push "disabled-result" if option.disabled and !(option.selected and @is_multiple)
@@ -86,7 +85,10 @@ class AbstractChosen
86
85
 
87
86
  style = if option.style.cssText != "" then " style=\"#{option.style}\"" else ""
88
87
 
89
- """<li id="#{option.dom_id}" class="#{classes.join(' ')}"#{style}>#{option.search_text}</li>"""
88
+ """<li class="#{classes.join(' ')}"#{style} data-option-array-index="#{option.array_index}">#{option.search_text}</li>"""
89
+
90
+ result_add_group: (group) ->
91
+ """<li class="group-result">#{group.search_text}</li>"""
90
92
 
91
93
  results_update_field: ->
92
94
  this.set_default_text()
@@ -94,6 +96,7 @@ class AbstractChosen
94
96
  this.result_clear_highlight()
95
97
  @result_single_selected = null
96
98
  this.results_build()
99
+ this.winnow_results() if @results_showing
97
100
 
98
101
  results_toggle: ->
99
102
  if @results_showing
@@ -119,42 +122,46 @@ class AbstractChosen
119
122
 
120
123
  for option in @results_data
121
124
  if not option.empty
122
- if option.group
123
- option.search_match = false
124
- else
125
+
126
+ option.group_match = false if option.group
127
+
128
+ unless option.group and not @group_search
125
129
  option.search_match = false
126
130
 
127
- if regex.test option.html
128
- option.search_match = true
129
- results += 1
130
- else if @enable_split_word_search and (option.html.indexOf(" ") >= 0 or option.html.indexOf("[") == 0)
131
- #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
132
- parts = option.html.replace(/\[|\]/g, "").split(" ")
133
- if parts.length
134
- for part in parts
135
- if regex.test part
136
- option.search_match = true
137
- results += 1
131
+ option.search_text = if option.group then option.label else option.html
132
+ option.search_match = this.search_string_match(option.search_text, regex)
133
+ results += 1 if option.search_match
138
134
 
139
135
  if option.search_match
140
136
  if searchText.length
141
- startpos = option.html.search zregex
142
- text = option.html.substr(0, startpos + searchText.length) + '</em>' + option.html.substr(startpos + searchText.length)
143
- text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
144
- else
145
- text = option.html
146
-
147
- option.search_text = text
137
+ startpos = option.search_text.search zregex
138
+ text = option.search_text.substr(0, startpos + searchText.length) + '</em>' + option.search_text.substr(startpos + searchText.length)
139
+ option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
148
140
 
149
- @results_data[option.group_array_index].search_match = true if option.group_array_index?
141
+ @results_data[option.group_array_index].group_match = true if option.group_array_index?
142
+
143
+ else if option.group_array_index? and @results_data[option.group_array_index].search_match
144
+ option.search_match = true
150
145
 
151
146
  if results < 1 and searchText.length
152
147
  this.update_results_content ""
148
+ this.result_clear_highlight()
153
149
  this.no_results searchText
154
150
  else
155
151
  this.update_results_content this.results_option_build()
156
152
  this.winnow_results_set_highlight()
157
153
 
154
+ search_string_match: (search_string, regex) ->
155
+ if regex.test search_string
156
+ return true
157
+ else if @enable_split_word_search and (search_string.indexOf(" ") >= 0 or search_string.indexOf("[") == 0)
158
+ #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
159
+ parts = search_string.replace(/\[|\]/g, "").split(" ")
160
+ if parts.length
161
+ for part in parts
162
+ if regex.test part
163
+ return true
164
+
158
165
  choices_count: ->
159
166
  return @selected_option_count if @selected_option_count?
160
167
 
@@ -189,16 +196,6 @@ class AbstractChosen
189
196
  # don't do anything on these keys
190
197
  else this.results_search()
191
198
 
192
- generate_field_id: ->
193
- new_id = this.generate_random_id()
194
- @form_field.id = new_id
195
- new_id
196
-
197
- generate_random_char: ->
198
- chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
199
- rand = Math.floor(Math.random() * chars.length)
200
- newchar = chars.substring rand, rand+1
201
-
202
199
  container_width: ->
203
200
  return if @options.width? then @options.width else "#{@form_field.offsetWidth}px"
204
201
 
@@ -213,5 +210,4 @@ class AbstractChosen
213
210
  @default_single_text: "Select an Option"
214
211
  @default_no_result_text: "No results match"
215
212
 
216
-
217
213
  root.AbstractChosen = AbstractChosen
@@ -1,5 +1,5 @@
1
1
  class SelectParser
2
-
2
+
3
3
  constructor: ->
4
4
  @options_index = 0
5
5
  @parsed = []
@@ -15,7 +15,7 @@ class SelectParser
15
15
  @parsed.push
16
16
  array_index: group_position
17
17
  group: true
18
- label: group.label
18
+ label: this.escapeExpression(group.label)
19
19
  children: 0
20
20
  disabled: group.disabled
21
21
  this.add_option( option, group_position, group.disabled ) for option in group.childNodes
@@ -43,6 +43,21 @@ class SelectParser
43
43
  empty: true
44
44
  @options_index += 1
45
45
 
46
+ escapeExpression: (text) ->
47
+ if not text? or text is false
48
+ return ""
49
+ unless /[\&\<\>\"\'\`]/.test(text)
50
+ return text
51
+ map =
52
+ "<": "&lt;"
53
+ ">": "&gt;"
54
+ '"': "&quot;"
55
+ "'": "&#x27;"
56
+ "`": "&#x60;"
57
+ unsafe_chars = /&(?!\w+;)|[\<\>\"\'\`]/g
58
+ text.replace unsafe_chars, (chr) ->
59
+ map[chr] || "&amp;"
60
+
46
61
  SelectParser.select_to_array = (select) ->
47
62
  parser = new SelectParser()
48
63
  parser.add_node( child ) for child in select.childNodes
@@ -0,0 +1,407 @@
1
+ @import "compass/css3/box-sizing";
2
+ @import "compass/css3/images";
3
+ @import "compass/css3/user-interface";
4
+
5
+ $chosen-sprite: image-url('chosen-sprite.png');
6
+ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
7
+
8
+ /* @group Base */
9
+ .chzn-container {
10
+ position: relative;
11
+ display: inline-block;
12
+ vertical-align: middle;
13
+ font-size: 13px;
14
+ zoom: 1;
15
+ *display: inline;
16
+ @include user-select(none);
17
+ .chzn-drop {
18
+ position: absolute;
19
+ top: 100%;
20
+ left: -9999px;
21
+ z-index: 1010;
22
+ @include box-sizing(border-box);
23
+ width: 100%;
24
+ border: 1px solid #aaa;
25
+ border-top: 0;
26
+ background: #fff;
27
+ box-shadow: 0 4px 5px rgba(#000,.15);
28
+ }
29
+ &.chzn-with-drop .chzn-drop {
30
+ left: 0;
31
+ }
32
+ }
33
+ /* @end */
34
+
35
+ /* @group Single Chosen */
36
+ .chzn-container-single{
37
+ .chzn-single {
38
+ position: relative;
39
+ display: block;
40
+ overflow: hidden;
41
+ padding: 0 0 0 8px;
42
+ height: 23px;
43
+ border: 1px solid #aaa;
44
+ border-radius: 5px;
45
+ background-color: #fff;
46
+ @include background(linear-gradient(top, #fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%));
47
+ background-clip: padding-box;
48
+ box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(#000,.1);
49
+ color: #444;
50
+ text-decoration: none;
51
+ white-space: nowrap;
52
+ line-height: 24px;
53
+ }
54
+ .chzn-default {
55
+ color: #999;
56
+ }
57
+ .chzn-single span {
58
+ display: block;
59
+ overflow: hidden;
60
+ margin-right: 26px;
61
+ text-overflow: ellipsis;
62
+ white-space: nowrap;
63
+ }
64
+ .chzn-single-with-deselect span {
65
+ margin-right: 38px;
66
+ }
67
+ .chzn-single abbr {
68
+ position: absolute;
69
+ top: 6px;
70
+ right: 26px;
71
+ display: block;
72
+ width: 12px;
73
+ height: 12px;
74
+ background: $chosen-sprite -42px 1px no-repeat;
75
+ font-size: 1px;
76
+ &:hover {
77
+ background-position: -42px -10px;
78
+ }
79
+ }
80
+ &.chzn-disabled .chzn-single abbr:hover {
81
+ background-position: -42px -10px;
82
+ }
83
+ .chzn-single div {
84
+ position: absolute;
85
+ top: 0;
86
+ right: 0;
87
+ display: block;
88
+ width: 18px;
89
+ height: 100%;
90
+ b {
91
+ display: block;
92
+ width: 100%;
93
+ height: 100%;
94
+ background: $chosen-sprite no-repeat 0px 2px;
95
+ }
96
+ }
97
+ .chzn-search {
98
+ position: relative;
99
+ z-index: 1010;
100
+ margin: 0;
101
+ padding: 3px 4px;
102
+ white-space: nowrap;
103
+ input[type="text"] {
104
+ @include box-sizing(border-box);
105
+ margin: 1px 0;
106
+ padding: 4px 20px 4px 5px;
107
+ width: 100%;
108
+ height: auto;
109
+ outline: 0;
110
+ border: 1px solid #aaa;
111
+ background: #fff $chosen-sprite no-repeat 100% -20px;
112
+ @include background($chosen-sprite no-repeat 100% -20px, linear-gradient(#eee 1%, #fff 15%));
113
+ font-size: 1em;
114
+ font-family: sans-serif;
115
+ line-height: normal;
116
+ border-radius: 0;
117
+ }
118
+ }
119
+ .chzn-drop {
120
+ margin-top: -1px;
121
+ border-radius: 0 0 4px 4px;
122
+ background-clip: padding-box;
123
+ }
124
+ &.chzn-container-single-nosearch .chzn-search {
125
+ position: absolute;
126
+ left: -9999px;
127
+ }
128
+ }
129
+ /* @end */
130
+
131
+ /* @group Results */
132
+ .chzn-container .chzn-results {
133
+ position: relative;
134
+ overflow-x: hidden;
135
+ overflow-y: auto;
136
+ margin: 0 4px 4px 0;
137
+ padding: 0 0 0 4px;
138
+ max-height: 240px;
139
+ -webkit-overflow-scrolling: touch;
140
+ li {
141
+ display: none;
142
+ margin: 0;
143
+ padding: 5px 6px;
144
+ list-style: none;
145
+ line-height: 15px;
146
+ &.active-result {
147
+ display: list-item;
148
+ cursor: pointer;
149
+ }
150
+ &.disabled-result {
151
+ display: list-item;
152
+ color: #ccc;
153
+ cursor: default;
154
+ }
155
+ &.highlighted {
156
+ background-color: #3875d7;
157
+ @include background-image(linear-gradient(#3875d7 20%, #2a62bc 90%));
158
+ color: #fff;
159
+ }
160
+ &.no-results {
161
+ display: list-item;
162
+ background: #f4f4f4;
163
+ }
164
+ &.group-result {
165
+ display: list-item;
166
+ font-weight: bold;
167
+ cursor: default;
168
+ }
169
+ &.group-option {
170
+ padding-left: 15px;
171
+ }
172
+ em {
173
+ font-style: normal;
174
+ text-decoration: underline;
175
+ }
176
+ }
177
+ }
178
+ /* @end */
179
+
180
+ /* @group Multi Chosen */
181
+ .chzn-container-multi{
182
+ .chzn-choices {
183
+ position: relative;
184
+ overflow: hidden;
185
+ @include box-sizing(border-box);
186
+ margin: 0;
187
+ padding: 0;
188
+ width: 100%;
189
+ height: auto !important;
190
+ height: 1%;
191
+ border: 1px solid #aaa;
192
+ background-color: #fff;
193
+ @include background-image(linear-gradient(#eee 1%, #fff 15%));
194
+ cursor: text;
195
+ }
196
+ .chzn-choices li {
197
+ float: left;
198
+ list-style: none;
199
+ &.search-field {
200
+ margin: 0;
201
+ padding: 0;
202
+ white-space: nowrap;
203
+ input[type="text"] {
204
+ margin: 1px 0;
205
+ padding: 5px;
206
+ height: 15px;
207
+ outline: 0;
208
+ border: 0 !important;
209
+ background: transparent !important;
210
+ box-shadow: none;
211
+ color: #666;
212
+ font-size: 100%;
213
+ font-family: sans-serif;
214
+ line-height: normal;
215
+ border-radius: 0;
216
+ }
217
+ .default {
218
+ color: #999;
219
+ }
220
+ }
221
+ &.search-choice {
222
+ position: relative;
223
+ margin: 3px 0 3px 5px;
224
+ padding: 3px 20px 3px 5px;
225
+ border: 1px solid #aaa;
226
+ border-radius: 3px;
227
+ background-color: #e4e4e4;
228
+ @include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
229
+ background-clip: padding-box;
230
+ box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(#000,.05);
231
+ color: #333;
232
+ line-height: 13px;
233
+ cursor: default;
234
+ .search-choice-close {
235
+ position: absolute;
236
+ top: 4px;
237
+ right: 3px;
238
+ display: block;
239
+ width: 12px;
240
+ height: 12px;
241
+ background: $chosen-sprite -42px 1px no-repeat;
242
+ font-size: 1px;
243
+ &:hover {
244
+ background-position: -42px -10px;
245
+ }
246
+ }
247
+ }
248
+ &.search-choice-disabled {
249
+ padding-right: 5px;
250
+ border: 1px solid #ccc;
251
+ background-color: #e4e4e4;
252
+ @include background-image(linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
253
+ color: #666;
254
+ }
255
+ &.search-choice-focus {
256
+ background: #d4d4d4;
257
+ .search-choice-close {
258
+ background-position: -42px -10px;
259
+ }
260
+ }
261
+ }
262
+ .chzn-results {
263
+ margin: 0;
264
+ padding: 0;
265
+ }
266
+ .chzn-drop .result-selected {
267
+ display: list-item;
268
+ color: #ccc;
269
+ cursor: default;
270
+ }
271
+ }
272
+ /* @end */
273
+
274
+ /* @group Active */
275
+ .chzn-container-active{
276
+ .chzn-single {
277
+ border: 1px solid #5897fb;
278
+ box-shadow: 0 0 5px rgba(#000,.3);
279
+ }
280
+ &.chzn-with-drop{
281
+ .chzn-single {
282
+ border: 1px solid #aaa;
283
+ -moz-border-radius-bottomright: 0;
284
+ border-bottom-right-radius: 0;
285
+ -moz-border-radius-bottomleft: 0;
286
+ border-bottom-left-radius: 0;
287
+ @include background-image(linear-gradient(#eee 20%, #fff 80%));
288
+ box-shadow: 0 1px 0 #fff inset;
289
+ }
290
+ .chzn-single div {
291
+ border-left: none;
292
+ background: transparent;
293
+ b {
294
+ background-position: -18px 2px;
295
+ }
296
+ }
297
+ }
298
+ .chzn-choices {
299
+ border: 1px solid #5897fb;
300
+ box-shadow: 0 0 5px rgba(#000,.3);
301
+ li.search-field input[type="text"] {
302
+ color: #111 !important;
303
+ }
304
+ }
305
+ }
306
+ /* @end */
307
+
308
+ /* @group Disabled Support */
309
+ .chzn-disabled {
310
+ opacity: 0.5 !important;
311
+ cursor: default;
312
+ .chzn-single {
313
+ cursor: default;
314
+ }
315
+ .chzn-choices .search-choice .search-choice-close {
316
+ cursor: default;
317
+ }
318
+ }
319
+ /* @end */
320
+
321
+ /* @group Right to Left */
322
+ .chzn-rtl {
323
+ text-align: right;
324
+ .chzn-single {
325
+ overflow: visible;
326
+ padding: 0 8px 0 0;
327
+ }
328
+ .chzn-single span {
329
+ margin-right: 0;
330
+ margin-left: 26px;
331
+ direction: rtl;
332
+ }
333
+ .chzn-single-with-deselect span {
334
+ margin-left: 38px;
335
+ }
336
+ .chzn-single div {
337
+ right: auto;
338
+ left: 3px;
339
+ }
340
+ .chzn-single abbr {
341
+ right: auto;
342
+ left: 26px;
343
+ }
344
+ .chzn-choices li {
345
+ float: right;
346
+ &.search-field input[type="text"] {
347
+ direction: rtl;
348
+ }
349
+ &.search-choice {
350
+ margin: 3px 5px 3px 0;
351
+ padding: 3px 5px 3px 19px;
352
+ .search-choice-close {
353
+ right: auto;
354
+ left: 4px;
355
+ }
356
+ }
357
+ }
358
+ &.chzn-container-single-nosearch .chzn-search,
359
+ .chzn-drop {
360
+ left: 9999px;
361
+ }
362
+ &.chzn-container-single .chzn-results {
363
+ margin: 0 0 4px 4px;
364
+ padding: 0 4px 0 0;
365
+ }
366
+ .chzn-results li.group-option {
367
+ padding-right: 15px;
368
+ padding-left: 0;
369
+ }
370
+ &.chzn-container-active.chzn-with-drop .chzn-single div {
371
+ border-right: none;
372
+ }
373
+ .chzn-search input[type="text"] {
374
+ padding: 4px 5px 4px 20px;
375
+ background: #fff $chosen-sprite no-repeat -30px -20px;
376
+ @include background($chosen-sprite no-repeat -30px -20px, linear-gradient(#eee 1%, #fff 15%));
377
+ direction: rtl;
378
+ }
379
+ &.chzn-container-single{
380
+ .chzn-single div b {
381
+ background-position: 6px 2px;
382
+ }
383
+ &.chzn-with-drop{
384
+ .chzn-single div b {
385
+ background-position: -12px 2px;
386
+ }
387
+ }
388
+ }
389
+ }
390
+
391
+ /* @end */
392
+
393
+ /* @group Retina compatibility */
394
+ @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
395
+ .chzn-rtl .chzn-search input[type="text"],
396
+ .chzn-container-single .chzn-single abbr,
397
+ .chzn-container-single .chzn-single div b,
398
+ .chzn-container-single .chzn-search input[type="text"],
399
+ .chzn-container-multi .chzn-choices .search-choice .search-choice-close,
400
+ .chzn-container .chzn-results-scroll-down span,
401
+ .chzn-container .chzn-results-scroll-up span {
402
+ background-image: $chosen-sprite-retina !important;
403
+ background-size: 52px 37px !important;
404
+ background-repeat: no-repeat !important;
405
+ }
406
+ }
407
+ /* @end */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chosen-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tse-Ching Ho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2013-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: compass-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -113,6 +127,7 @@ files:
113
127
  - lib/chosen-rails/engine3.rb
114
128
  - lib/chosen-rails/railtie.rb
115
129
  - lib/chosen-rails/source_file.rb
130
+ - lib/chosen-rails/tasks.rake
116
131
  - lib/chosen-rails/version.rb
117
132
  - vendor/assets/images/chosen-sprite.png
118
133
  - vendor/assets/images/chosen-sprite@2x.png
@@ -123,6 +138,7 @@ files:
123
138
  - vendor/assets/javascripts/lib/abstract-chosen.coffee
124
139
  - vendor/assets/javascripts/lib/select-parser.coffee
125
140
  - vendor/assets/stylesheets/chosen.css.sass
141
+ - vendor/assets/stylesheets/chosen.css.scss
126
142
  homepage: https://github.com/tsechingho/chosen-rails
127
143
  licenses: []
128
144
  metadata: {}