chosen-rails 1.8.2 → 1.10.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
- SHA1:
3
- metadata.gz: 84d37ed2825106c6c400858bff7497d7d9319335
4
- data.tar.gz: 6f5a6bbbdf12cf07e6830d3c4ed9f834b6409f5b
2
+ SHA256:
3
+ metadata.gz: cb9a01d9e95e9334d789999deed11a5f4eeff7f7bf4aded85153ccb90e2cdb60
4
+ data.tar.gz: e0598c9ee4777bffaee6f134fe1f8d0b01d9bfc2d5e93291f24246d94a7ecabe
5
5
  SHA512:
6
- metadata.gz: 6e61368b655875ed16a8b99080fb0a2344e249e3ae96121bee97f40f7bda9c060f4d0e6078b8a2bc41fbfe3847e55c456020b4a6fd0150ccdcaf14e76b75aa28
7
- data.tar.gz: c092ae8213173a6e1d357dea55fbb6cdad215a72e09efbcbd628864a48e7aa2d30217b0871f4c2515eb58593c52916940cad55d7641987576a9984c691c51913
6
+ metadata.gz: deff791359ce236e7bcb49d58979c8e57e4732e4feb8b6707359ff93ce4e918a143a7e8010e9a0a346c723bad9364596babb8081e5d97680b1afee2fc0a130ba
7
+ data.tar.gz: '0832921699aa80ee2771bc75074e651261587f620aa6a70118208e5035cbe8f567d4bae95e4006587a52e3a0964e0eb7ce758414453634332b1c35cfc83eeb4e'
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [Chosen](https://github.com/harvesthq/chosen) is a library for making long, unwieldy select boxes more user friendly.
4
4
 
5
- The `chosen-rails` gem integrates the `Chosen` with the Rails asset pipeline.
5
+ The `chosen-rails` gem integrates the `Chosen` into Rails asset pipeline with the [sprockets-rails](https://github.com/rails/sprockets-rails).
6
6
 
7
7
  ## Usage
8
8
 
@@ -11,11 +11,16 @@ The `chosen-rails` gem integrates the `Chosen` with the Rails asset pipeline.
11
11
  Include `chosen-rails` in Gemfile
12
12
 
13
13
  ```rb
14
+ gem 'jquery-rails'
14
15
  gem 'chosen-rails'
15
16
  ```
16
17
 
17
18
  Then run `bundle install`
18
19
 
20
+ ### About JQuery
21
+
22
+ You can get jquery via [jquery-rails](https://github.com/rails/jquery-rails).
23
+
19
24
  Please consider [jquery-turbolinks](https://github.com/kossnocorp/jquery.turbolinks) if you have turbolinks issues for Rails 4 +.
20
25
 
21
26
  ### Include chosen javascript assets
@@ -23,12 +28,14 @@ Please consider [jquery-turbolinks](https://github.com/kossnocorp/jquery.turboli
23
28
  Add to your `app/assets/javascripts/application.js` if use with jQuery
24
29
 
25
30
  ```coffee
31
+ //= require jquery
26
32
  //= require chosen-jquery
27
33
  ```
28
34
 
29
35
  Or with Prototype
30
36
 
31
37
  ```coffee
38
+ //= require jquery
32
39
  //= require chosen-prototype
33
40
  ```
34
41
 
@@ -42,6 +49,12 @@ Add to your `app/assets/stylesheets/application.css`
42
49
 
43
50
  ### Enable chosen javascript by specific css class
44
51
 
52
+ For rails 6, remember to add `javascript_include_tag` in `app/views/layouts/application.html.erb`, like
53
+
54
+ ```ruby
55
+ <%= javascript_include_tag 'application' %>
56
+ ```
57
+
45
58
  Add to one coffee script file, like `scaffold.js.coffee`
46
59
 
47
60
  ```coffee
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ task 'update-chosen', 'repository_url', 'branch' do |task, args|
9
9
  files = SourceFile.new
10
10
  files.fetch remote, branch
11
11
  files.eject_javascript_class_from_closure
12
- files.remove_compass_lines
13
12
  files.add_depend_on_asset
13
+ files.change_url_to_image_url
14
14
  files.cleanup
15
15
  end
data/chosen-rails.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
 
19
19
  gem.add_dependency 'railties', '>= 3.0'
20
20
  gem.add_dependency 'coffee-rails', '>= 3.2'
21
- gem.add_dependency 'sass-rails', '>= 3.2'
21
+ gem.add_dependency 'sassc-rails', '>= 2.1.2'
22
22
 
23
23
  gem.add_development_dependency 'bundler', '>= 1.0'
24
24
  gem.add_development_dependency 'rails', '>= 3.0'
@@ -34,22 +34,22 @@ module Chosen
34
34
  def chosen_find_container(from, options)
35
35
  from = from.to_s
36
36
 
37
- id = from
37
+ id = from.underscore
38
38
  id = "##{id}" unless from.start_with?('#')
39
39
  id = "#{id}_chosen" unless from.end_with?('_chosen')
40
40
 
41
- find(:css, id, options)
41
+ find(:css, id, **options)
42
42
  rescue Capybara::ElementNotFound
43
- label = find('label', { text: from }.merge(options))
43
+ label = find('label', **{ text: from }.merge(options))
44
44
 
45
- find(:css, "##{label[:for]}_chosen", options)
45
+ find(:css, "##{label[:for].underscore}_chosen", **options)
46
46
  end
47
47
 
48
48
  def chosen_find_input(from, options)
49
49
  from = from.to_s
50
50
  from = "##{from}" unless from.start_with?('#')
51
51
 
52
- find(:css, from, options)
52
+ find(:css, from.underscore, **options)
53
53
  end
54
54
 
55
55
  def chosen_multiselect?(input)
@@ -88,5 +88,6 @@ module Chosen
88
88
  end
89
89
 
90
90
  RSpec.configure do |config|
91
+ config.include Chosen::Rspec::FeatureHelpers, type: :system
91
92
  config.include Chosen::Rspec::FeatureHelpers, type: :feature
92
93
  end
@@ -31,14 +31,6 @@ class SourceFile < Thor
31
31
  end
32
32
  end
33
33
 
34
- desc 'remove compass lines', 'remove compass lines'
35
- def remove_compass_lines
36
- self.destination_root = 'vendor/assets'
37
- gsub_file 'stylesheets/chosen-base.scss', /^\s*\@include.*\n/, ''
38
- gsub_file 'stylesheets/chosen-base.scss', /^\@import.*\n/, ''
39
- # gsub_file 'stylesheets/chosen-base.scss', /\n(\$chosen-sprite:)/, '\1'
40
- end
41
-
42
34
  desc 'add depend_on_asset', 'add depend_on_asset'
43
35
  def add_depend_on_asset
44
36
  self.destination_root = 'vendor/assets'
@@ -49,6 +41,12 @@ class SourceFile < Thor
49
41
  prepend_to_file 'stylesheets/chosen-base.scss', scss
50
42
  end
51
43
 
44
+ desc 'change url to image url', 'change url to image url'
45
+ def change_url_to_image_url
46
+ self.destination_root = 'vendor/assets'
47
+ gsub_file 'stylesheets/chosen-base.scss', /url/, 'image-url'
48
+ end
49
+
52
50
  desc 'clean up useless files', 'clean up useless files'
53
51
  def cleanup
54
52
  self.destination_root = 'vendor/assets'
@@ -1,6 +1,6 @@
1
1
  module Chosen
2
2
  module Rails
3
- VERSION = '1.8.2'
4
- CHOSEN_VERSION = '1.8.2'
3
+ VERSION = '1.10.0'
4
+ CHOSEN_VERSION = '1.8.7'
5
5
  end
6
6
  end
data/lib/chosen-rails.rb CHANGED
@@ -6,7 +6,7 @@ module Chosen
6
6
  end
7
7
 
8
8
  case ::Rails.version.to_s
9
- when /^(4|5)/
9
+ when /^(4|5|6|7)/
10
10
  require 'chosen-rails/engine'
11
11
  when /^3\.[12]/
12
12
  require 'chosen-rails/engine3'
@@ -198,7 +198,7 @@ class Chosen extends AbstractChosen
198
198
 
199
199
  if @is_multiple
200
200
  @search_choices.find("li.search-choice").remove()
201
- else if not @is_multiple
201
+ else
202
202
  this.single_set_selected_text()
203
203
  if @disable_search or @form_field.options.length <= @disable_search_threshold
204
204
  @search_field[0].readOnly = true
@@ -366,7 +366,6 @@ class Chosen extends AbstractChosen
366
366
 
367
367
  @form_field.options[item.options_index].selected = true
368
368
  @selected_option_count = null
369
- @search_field.val("")
370
369
 
371
370
  if @is_multiple
372
371
  this.choice_build item
@@ -374,7 +373,11 @@ class Chosen extends AbstractChosen
374
373
  this.single_set_selected_text(this.choice_label(item))
375
374
 
376
375
  if @is_multiple && (!@hide_results_on_select || (evt.metaKey or evt.ctrlKey))
377
- this.winnow_results()
376
+ if evt.metaKey or evt.ctrlKey
377
+ this.winnow_results(skip_highlight: true)
378
+ else
379
+ @search_field.val("")
380
+ this.winnow_results()
378
381
  else
379
382
  this.results_hide()
380
383
  this.show_search_field_default()
@@ -191,7 +191,7 @@ class @Chosen extends AbstractChosen
191
191
 
192
192
  if @is_multiple
193
193
  @search_choices.select("li.search-choice").invoke("remove")
194
- else if not @is_multiple
194
+ else
195
195
  this.single_set_selected_text()
196
196
  if @disable_search or @form_field.options.length <= @disable_search_threshold
197
197
  @search_field.readOnly = true
@@ -358,7 +358,6 @@ class @Chosen extends AbstractChosen
358
358
 
359
359
  @form_field.options[item.options_index].selected = true
360
360
  @selected_option_count = null
361
- @search_field.value = ""
362
361
 
363
362
  if @is_multiple
364
363
  this.choice_build item
@@ -366,7 +365,11 @@ class @Chosen extends AbstractChosen
366
365
  this.single_set_selected_text(this.choice_label(item))
367
366
 
368
367
  if @is_multiple && (!@hide_results_on_select || (evt.metaKey or evt.ctrlKey))
369
- this.winnow_results()
368
+ if evt.metaKey or evt.ctrlKey
369
+ this.winnow_results(skip_highlight: true)
370
+ else
371
+ @search_field.value = ""
372
+ this.winnow_results()
370
373
  else
371
374
  this.results_hide()
372
375
  this.show_search_field_default()
@@ -51,7 +51,7 @@ class AbstractChosen
51
51
 
52
52
  choice_label: (item) ->
53
53
  if @include_group_label_in_selected and item.group_label?
54
- "<b class='group-name'>#{item.group_label}</b>#{item.html}"
54
+ "<b class='group-name'>#{this.escape_html(item.group_label)}</b>#{item.html}"
55
55
  else
56
56
  item.html
57
57
 
@@ -114,7 +114,7 @@ class AbstractChosen
114
114
 
115
115
  option_el = document.createElement("li")
116
116
  option_el.className = classes.join(" ")
117
- option_el.style.cssText = option.style
117
+ option_el.style.cssText = option.style if option.style
118
118
  option_el.setAttribute("data-option-array-index", option.array_index)
119
119
  option_el.innerHTML = option.highlighted_html or option.html
120
120
  option_el.title = option.title if option.title
@@ -159,7 +159,7 @@ class AbstractChosen
159
159
  else
160
160
  this.results_show()
161
161
 
162
- winnow_results: ->
162
+ winnow_results: (options) ->
163
163
  this.no_results_clear()
164
164
 
165
165
  results = 0
@@ -214,7 +214,7 @@ class AbstractChosen
214
214
  this.no_results query
215
215
  else
216
216
  this.update_results_content this.results_option_build()
217
- this.winnow_results_set_highlight()
217
+ this.winnow_results_set_highlight() unless options?.skip_highlight
218
218
 
219
219
  get_search_regex: (escaped_search_string) ->
220
220
  regex_string = if @search_contains then escaped_search_string else "(^|\\s|\\b)#{escaped_search_string}[^\\s]*"
@@ -1,7 +1,7 @@
1
1
  //= depend_on_asset "chosen-sprite.png"
2
2
  //= depend_on_asset "chosen-sprite@2x.png"
3
- $chosen-sprite: url('chosen-sprite.png') !default;
4
- $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
3
+ $chosen-sprite: image-url('chosen-sprite.png') !default;
4
+ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
5
5
 
6
6
  /* @group Base */
7
7
  .chosen-container {
@@ -23,9 +23,11 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
23
23
  background: #fff;
24
24
  box-shadow: 0 4px 5px rgba(#000,.15);
25
25
  clip: rect(0,0,0,0);
26
+ clip-path: inset(100% 100%);
26
27
  }
27
28
  &.chosen-with-drop .chosen-drop {
28
29
  clip: auto;
30
+ clip-path: none;
29
31
  }
30
32
  a{
31
33
  cursor: pointer;
@@ -140,6 +142,7 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
140
142
  &.chosen-container-single-nosearch .chosen-search {
141
143
  position: absolute;
142
144
  clip: rect(0,0,0,0);
145
+ clip-path: inset(100% 100%);
143
146
  }
144
147
  }
145
148
  /* @end */
@@ -1,59 +1,425 @@
1
- @import "chosen-base";
2
-
3
- //= depend_on_asset "chosen-sprite.png"
4
- //= depend_on_asset "chosen-sprite@2x.png"
5
-
6
1
  $chosen-sprite: image-url('chosen-sprite.png') !default;
7
2
  $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
8
3
 
4
+ /* @group Base */
9
5
  .chosen-container {
6
+ position: relative;
7
+ display: inline-block;
8
+ vertical-align: middle;
9
+ font-size: 13px;
10
10
  user-select: none;
11
11
  * {
12
12
  box-sizing: border-box;
13
13
  }
14
+ .chosen-drop {
15
+ position: absolute;
16
+ top: 100%;
17
+ z-index: 1010;
18
+ width: 100%;
19
+ border: 1px solid #aaa;
20
+ border-top: 0;
21
+ background: #fff;
22
+ box-shadow: 0 4px 5px rgba(#000,.15);
23
+ clip: rect(0,0,0,0);
24
+ clip-path: inset(100% 100%);
25
+ }
26
+ &.chosen-with-drop .chosen-drop {
27
+ clip: auto;
28
+ clip-path: none;
29
+ }
30
+ a{
31
+ cursor: pointer;
32
+ }
33
+
34
+ .search-choice, .chosen-single{
35
+ .group-name{
36
+ margin-right: 4px;
37
+ overflow: hidden;
38
+ white-space: nowrap;
39
+ text-overflow: ellipsis;
40
+ font-weight: normal;
41
+ color: #999999;
42
+ &:after {
43
+ content: ":";
44
+ padding-left: 2px;
45
+ vertical-align: top;
46
+ }
47
+ }
48
+ }
14
49
  }
50
+ /* @end */
15
51
 
16
- .chosen-container-single {
52
+ /* @group Single Chosen */
53
+ .chosen-container-single{
17
54
  .chosen-single {
55
+ position: relative;
56
+ display: block;
57
+ overflow: hidden;
58
+ padding: 0 0 0 8px;
59
+ height: 25px;
60
+ border: 1px solid #aaa;
61
+ border-radius: 5px;
62
+ background-color: #fff;
18
63
  background: linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%);
64
+ background-clip: padding-box;
65
+ box-shadow: 0 0 3px #fff inset, 0 1px 1px rgba(#000,.1);
66
+ color: #444;
67
+ text-decoration: none;
68
+ white-space: nowrap;
69
+ line-height: 24px;
70
+ }
71
+ .chosen-default {
72
+ color: #999;
73
+ }
74
+ .chosen-single span {
75
+ display: block;
76
+ overflow: hidden;
77
+ margin-right: 26px;
78
+ text-overflow: ellipsis;
79
+ white-space: nowrap;
80
+ }
81
+ .chosen-single-with-deselect span {
82
+ margin-right: 38px;
83
+ }
84
+ .chosen-single abbr {
85
+ position: absolute;
86
+ top: 6px;
87
+ right: 26px;
88
+ display: block;
89
+ width: 12px;
90
+ height: 12px;
91
+ background: $chosen-sprite -42px 1px no-repeat;
92
+ font-size: 1px;
93
+ &:hover {
94
+ background-position: -42px -10px;
95
+ }
96
+ }
97
+ &.chosen-disabled .chosen-single abbr:hover {
98
+ background-position: -42px -10px;
99
+ }
100
+ .chosen-single div {
101
+ position: absolute;
102
+ top: 0;
103
+ right: 0;
104
+ display: block;
105
+ width: 18px;
106
+ height: 100%;
107
+ b {
108
+ display: block;
109
+ width: 100%;
110
+ height: 100%;
111
+ background: $chosen-sprite no-repeat 0px 2px;
112
+ }
19
113
  }
20
114
  .chosen-search {
21
- background: $chosen-sprite no-repeat 100% -20px;
115
+ position: relative;
116
+ z-index: 1010;
117
+ margin: 0;
118
+ padding: 3px 4px;
119
+ white-space: nowrap;
120
+
121
+ input[type="text"] {
122
+ margin: 1px 0;
123
+ padding: 4px 20px 4px 5px;
124
+ width: 100%;
125
+ height: auto;
126
+ outline: 0;
127
+ border: 1px solid #aaa;
128
+ background: $chosen-sprite no-repeat 100% -20px;
129
+ font-size: 1em;
130
+ font-family: sans-serif;
131
+ line-height: normal;
132
+ border-radius: 0;
133
+ }
134
+ }
135
+ .chosen-drop {
136
+ margin-top: -1px;
137
+ border-radius: 0 0 4px 4px;
138
+ background-clip: padding-box;
139
+ }
140
+ &.chosen-container-single-nosearch .chosen-search {
141
+ position: absolute;
142
+ clip: rect(0,0,0,0);
143
+ clip-path: inset(100% 100%);
22
144
  }
23
145
  }
146
+ /* @end */
24
147
 
148
+ /* @group Results */
25
149
  .chosen-container .chosen-results {
150
+ color: #444;
151
+ position: relative;
152
+ overflow-x: hidden;
153
+ overflow-y: auto;
154
+ margin: 0 4px 4px 0;
155
+ padding: 0 0 0 4px;
156
+ max-height: 240px;
157
+ -webkit-overflow-scrolling: touch;
26
158
  li {
159
+ display: none;
160
+ margin: 0;
161
+ padding: 5px 6px;
162
+ list-style: none;
163
+ line-height: 15px;
164
+ word-wrap: break-word;
165
+ -webkit-touch-callout: none;
166
+ &.active-result {
167
+ display: list-item;
168
+ cursor: pointer;
169
+ }
170
+ &.disabled-result {
171
+ display: list-item;
172
+ color: #ccc;
173
+ cursor: default;
174
+ }
27
175
  &.highlighted {
176
+ background-color: #3875d7;
28
177
  background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
178
+ color: #fff;
179
+ }
180
+ &.no-results {
181
+ color: #777;
182
+ display: list-item;
183
+ background: #f4f4f4;
184
+ }
185
+ &.group-result {
186
+ display: list-item;
187
+ font-weight: bold;
188
+ cursor: default;
189
+ }
190
+ &.group-option {
191
+ padding-left: 15px;
192
+ }
193
+ em {
194
+ font-style: normal;
195
+ text-decoration: underline;
29
196
  }
30
197
  }
31
198
  }
199
+ /* @end */
32
200
 
33
- .chosen-container-multi {
201
+ /* @group Multi Chosen */
202
+ .chosen-container-multi{
34
203
  .chosen-choices {
204
+ position: relative;
205
+ overflow: hidden;
206
+ margin: 0;
207
+ padding: 0 5px;
208
+ width: 100%;
209
+ height: auto;
210
+ border: 1px solid #aaa;
211
+ background-color: #fff;
35
212
  background-image: linear-gradient(#eee 1%, #fff 15%);
213
+ cursor: text;
36
214
  }
37
215
  .chosen-choices li {
216
+ float: left;
217
+ list-style: none;
218
+ &.search-field {
219
+ margin: 0;
220
+ padding: 0;
221
+ white-space: nowrap;
222
+ input[type="text"] {
223
+ margin: 1px 0;
224
+ padding: 0;
225
+ height: 25px;
226
+ outline: 0;
227
+ border: 0 !important;
228
+ background: transparent !important;
229
+ box-shadow: none;
230
+ color: #999;
231
+ font-size: 100%;
232
+ font-family: sans-serif;
233
+ line-height: normal;
234
+ border-radius: 0;
235
+ width: 25px;
236
+ }
237
+ }
38
238
  &.search-choice {
239
+ position: relative;
240
+ margin: 3px 5px 3px 0;
241
+ padding: 3px 20px 3px 5px;
242
+ border: 1px solid #aaa;
243
+ max-width: 100%;
244
+ border-radius: 3px;
245
+ background-color: #eeeeee;
39
246
  background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
247
+ background-size: 100% 19px;
248
+ background-repeat: repeat-x;
249
+ background-clip: padding-box;
250
+ box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(#000,.05);
251
+ color: #333;
252
+ line-height: 13px;
253
+ cursor: default;
254
+ span {
255
+ word-wrap: break-word;
256
+ }
257
+ .search-choice-close {
258
+ position: absolute;
259
+ top: 4px;
260
+ right: 3px;
261
+ display: block;
262
+ width: 12px;
263
+ height: 12px;
264
+ background: $chosen-sprite -42px 1px no-repeat;
265
+ font-size: 1px;
266
+ &:hover {
267
+ background-position: -42px -10px;
268
+ }
269
+ }
40
270
  }
41
271
  &.search-choice-disabled {
272
+ padding-right: 5px;
273
+ border: 1px solid #ccc;
274
+ background-color: #e4e4e4;
42
275
  background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%);
276
+ color: #666;
277
+ }
278
+ &.search-choice-focus {
279
+ background: #d4d4d4;
280
+ .search-choice-close {
281
+ background-position: -42px -10px;
282
+ }
43
283
  }
44
284
  }
285
+ .chosen-results {
286
+ margin: 0;
287
+ padding: 0;
288
+ }
289
+ .chosen-drop .result-selected {
290
+ display: list-item;
291
+ color: #ccc;
292
+ cursor: default;
293
+ }
45
294
  }
295
+ /* @end */
46
296
 
47
- .chosen-container-active {
297
+ /* @group Active */
298
+ .chosen-container-active{
299
+ .chosen-single {
300
+ border: 1px solid #5897fb;
301
+ box-shadow: 0 0 5px rgba(#000,.3);
302
+ }
48
303
  &.chosen-with-drop{
49
304
  .chosen-single {
305
+ border: 1px solid #aaa;
306
+ -moz-border-radius-bottomright: 0;
307
+ border-bottom-right-radius: 0;
308
+ -moz-border-radius-bottomleft: 0;
309
+ border-bottom-left-radius: 0;
50
310
  background-image: linear-gradient(#eee 20%, #fff 80%);
311
+ box-shadow: 0 1px 0 #fff inset;
312
+ }
313
+ .chosen-single div {
314
+ border-left: none;
315
+ background: transparent;
316
+ b {
317
+ background-position: -18px 2px;
318
+ }
319
+ }
320
+ }
321
+ .chosen-choices {
322
+ border: 1px solid #5897fb;
323
+ box-shadow: 0 0 5px rgba(#000,.3);
324
+ li.search-field input[type="text"] {
325
+ color: #222 !important;
51
326
  }
52
327
  }
53
328
  }
329
+ /* @end */
330
+
331
+ /* @group Disabled Support */
332
+ .chosen-disabled {
333
+ opacity: 0.5 !important;
334
+ cursor: default;
335
+ .chosen-single {
336
+ cursor: default;
337
+ }
338
+ .chosen-choices .search-choice .search-choice-close {
339
+ cursor: default;
340
+ }
341
+ }
342
+ /* @end */
54
343
 
344
+ /* @group Right to Left */
55
345
  .chosen-rtl {
346
+ text-align: right;
347
+ .chosen-single {
348
+ overflow: visible;
349
+ padding: 0 8px 0 0;
350
+ }
351
+ .chosen-single span {
352
+ margin-right: 0;
353
+ margin-left: 26px;
354
+ direction: rtl;
355
+ }
356
+ .chosen-single-with-deselect span {
357
+ margin-left: 38px;
358
+ }
359
+ .chosen-single div {
360
+ right: auto;
361
+ left: 3px;
362
+ }
363
+ .chosen-single abbr {
364
+ right: auto;
365
+ left: 26px;
366
+ }
367
+ .chosen-choices li {
368
+ float: right;
369
+ &.search-field input[type="text"] {
370
+ direction: rtl;
371
+ }
372
+ &.search-choice {
373
+ margin: 3px 5px 3px 0;
374
+ padding: 3px 5px 3px 19px;
375
+ .search-choice-close {
376
+ right: auto;
377
+ left: 4px;
378
+ }
379
+ }
380
+ }
381
+ &.chosen-container-single .chosen-results {
382
+ margin: 0 0 4px 4px;
383
+ padding: 0 4px 0 0;
384
+ }
385
+ .chosen-results li.group-option {
386
+ padding-right: 15px;
387
+ padding-left: 0;
388
+ }
389
+ &.chosen-container-active.chosen-with-drop .chosen-single div {
390
+ border-right: none;
391
+ }
56
392
  .chosen-search input[type="text"] {
393
+ padding: 4px 5px 4px 20px;
57
394
  background: $chosen-sprite no-repeat -30px -20px;
395
+ direction: rtl;
396
+ }
397
+ &.chosen-container-single{
398
+ .chosen-single div b {
399
+ background-position: 6px 2px;
400
+ }
401
+ &.chosen-with-drop{
402
+ .chosen-single div b {
403
+ background-position: -12px 2px;
404
+ }
405
+ }
406
+ }
407
+ }
408
+
409
+ /* @end */
410
+
411
+ /* @group Retina compatibility */
412
+ @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min-resolution: 144dpi), only screen and (min-resolution: 1.5dppx) {
413
+ .chosen-rtl .chosen-search input[type="text"],
414
+ .chosen-container-single .chosen-single abbr,
415
+ .chosen-container-single .chosen-single div b,
416
+ .chosen-container-single .chosen-search input[type="text"],
417
+ .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
418
+ .chosen-container .chosen-results-scroll-down span,
419
+ .chosen-container .chosen-results-scroll-up span {
420
+ background-image: $chosen-sprite-retina !important;
421
+ background-size: 52px 37px !important;
422
+ background-repeat: no-repeat !important;
58
423
  }
59
424
  }
425
+ /* @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: 1.8.2
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tse-Ching Ho
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: sass-rails
42
+ name: sassc-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '3.2'
47
+ version: 2.1.2
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '3.2'
54
+ version: 2.1.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -125,13 +125,12 @@ files:
125
125
  - vendor/assets/javascripts/lib/abstract-chosen.coffee
126
126
  - vendor/assets/javascripts/lib/select-parser.coffee
127
127
  - vendor/assets/stylesheets/chosen-base.scss
128
- - vendor/assets/stylesheets/chosen-compass.scss
129
128
  - vendor/assets/stylesheets/chosen.scss
130
129
  homepage: https://github.com/tsechingho/chosen-rails
131
130
  licenses:
132
131
  - MIT
133
132
  metadata: {}
134
- post_install_message:
133
+ post_install_message:
135
134
  rdoc_options: []
136
135
  require_paths:
137
136
  - lib
@@ -146,9 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
145
  - !ruby/object:Gem::Version
147
146
  version: '0'
148
147
  requirements: []
149
- rubyforge_project:
150
- rubygems_version: 2.6.13
151
- signing_key:
148
+ rubygems_version: 3.2.22
149
+ signing_key:
152
150
  specification_version: 4
153
151
  summary: Integrate Chosen javascript library with Rails asset pipeline
154
152
  test_files: []
@@ -1,63 +0,0 @@
1
- @import "chosen-base";
2
-
3
- @import "compass/css3/box-sizing";
4
- @import "compass/css3/images";
5
- @import "compass/css3/user-interface";
6
-
7
- //= depend_on_asset "chosen-sprite.png"
8
- //= depend_on_asset "chosen-sprite@2x.png"
9
-
10
- $chosen-sprite: image-url('chosen-sprite.png') !default;
11
- $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
12
-
13
- .chosen-container {
14
- @include user-select(none);
15
- * {
16
- @include box-sizing(border-box);
17
- }
18
- }
19
-
20
- .chosen-container-single{
21
- .chosen-single {
22
- @include background(linear-gradient(#fff 20%, #f6f6f6 50%, #eee 52%, #f4f4f4 100%));
23
- }
24
- .chosen-search {
25
- @include background($chosen-sprite no-repeat 100% -20px);
26
- }
27
- }
28
-
29
- .chosen-container .chosen-results {
30
- li {
31
- &.highlighted {
32
- @include background-image(linear-gradient(#3875d7 20%, #2a62bc 90%));
33
- }
34
- }
35
- }
36
-
37
- .chosen-container-multi{
38
- .chosen-choices {
39
- @include background-image(linear-gradient(#eee 1%, #fff 15%));
40
- }
41
- .chosen-choices li {
42
- &.search-choice {
43
- @include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
44
- }
45
- &.search-choice-disabled {
46
- @include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
47
- }
48
- }
49
- }
50
-
51
- .chosen-container-active{
52
- &.chosen-with-drop{
53
- .chosen-single {
54
- @include background-image(linear-gradient(#eee 20%, #fff 80%));
55
- }
56
- }
57
- }
58
-
59
- .chosen-rtl {
60
- .chosen-search input[type="text"] {
61
- @include background($chosen-sprite no-repeat -30px -20px);
62
- }
63
- }