chosen-rails 1.8.3 → 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f599fc9219c82b346546715590bf8d280ec348e2
4
- data.tar.gz: 560ab65918b5f25d8a7e9c7378ee15cbb9307667
2
+ SHA256:
3
+ metadata.gz: 5c19217ddd35b9869cad0624eaf45909a73d27f942861c3cf6218814d8ef0bcc
4
+ data.tar.gz: bd94b35268e11a25115f136d31f121059337ee7794d87eb85bea3364c94db06f
5
5
  SHA512:
6
- metadata.gz: b5766a27dbb1e75b3136ee2ec30c59bcb4bd66bf520517f692748b8049b0604087089421460ab3bfbdb605469660e724bf49bbcb5bdb46f61cfa4f93d328276b
7
- data.tar.gz: 88dd198e47d9022f28ebe8ad6ba7e25379a123d76cbe041dfa68e57750aa4669a77c4e53c08fb2cf87524c1049b404102325181e9554da5e86c1c76fce9bbe03
6
+ metadata.gz: 64e45ca0173cda5d16fc7d63a87294745b381156469ca9b1af6e6f2ad7f985d72a4125c3ac561f635a2afc30a4fe57e286ca77d7ca38bbbc0fc940e46b99d07e
7
+ data.tar.gz: 6836a1e3511aaabd044dbb2cdbb6b77fde7a6a2d35602a70ccf05dba4dd1261af9d145620e831f788308180b5ad0ac4f2aba127bf7f9ce8815ad8bb6a6629b96
data/Rakefile CHANGED
@@ -11,5 +11,6 @@ task 'update-chosen', 'repository_url', 'branch' do |task, args|
11
11
  files.eject_javascript_class_from_closure
12
12
  files.remove_compass_lines
13
13
  files.add_depend_on_asset
14
+ files.change_url_to_image_url
14
15
  files.cleanup
15
16
  end
@@ -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
@@ -49,6 +49,12 @@ class SourceFile < Thor
49
49
  prepend_to_file 'stylesheets/chosen-base.scss', scss
50
50
  end
51
51
 
52
+ desc 'change url to image url', 'change url to image url'
53
+ def change_url_to_image_url
54
+ self.destination_root = 'vendor/assets'
55
+ gsub_file 'stylesheets/chosen-base.scss', /url/, 'image-url'
56
+ end
57
+
52
58
  desc 'clean up useless files', 'clean up useless files'
53
59
  def cleanup
54
60
  self.destination_root = 'vendor/assets'
@@ -1,6 +1,6 @@
1
1
  module Chosen
2
2
  module Rails
3
- VERSION = '1.8.3'
4
- CHOSEN_VERSION = '1.8.3'
3
+ VERSION = '1.8.7'
4
+ CHOSEN_VERSION = '1.8.7'
5
5
  end
6
6
  end
@@ -243,9 +243,6 @@ class Chosen extends AbstractChosen
243
243
  @form_field_jq.trigger("chosen:maxselected", {chosen: this})
244
244
  return false
245
245
 
246
- unless @is_multiple
247
- @search_container.append @search_field
248
-
249
246
  @container.addClass "chosen-with-drop"
250
247
  @results_showing = true
251
248
 
@@ -262,10 +259,6 @@ class Chosen extends AbstractChosen
262
259
  if @results_showing
263
260
  this.result_clear_highlight()
264
261
 
265
- unless @is_multiple
266
- @selected_item.prepend @search_field
267
- @search_field.focus()
268
-
269
262
  @container.removeClass "chosen-with-drop"
270
263
  @form_field_jq.trigger("chosen:hiding_dropdown", {chosen: this})
271
264
 
@@ -373,7 +366,6 @@ class Chosen extends AbstractChosen
373
366
 
374
367
  @form_field.options[item.options_index].selected = true
375
368
  @selected_option_count = null
376
- @search_field.val("")
377
369
 
378
370
  if @is_multiple
379
371
  this.choice_build item
@@ -381,7 +373,11 @@ class Chosen extends AbstractChosen
381
373
  this.single_set_selected_text(this.choice_label(item))
382
374
 
383
375
  if @is_multiple && (!@hide_results_on_select || (evt.metaKey or evt.ctrlKey))
384
- 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()
385
381
  else
386
382
  this.results_hide()
387
383
  this.show_search_field_default()
@@ -235,9 +235,6 @@ class @Chosen extends AbstractChosen
235
235
  @form_field.fire("chosen:maxselected", {chosen: this})
236
236
  return false
237
237
 
238
- unless @is_multiple
239
- @search_container.insert @search_field
240
-
241
238
  @container.addClassName "chosen-with-drop"
242
239
  @results_showing = true
243
240
 
@@ -254,10 +251,6 @@ class @Chosen extends AbstractChosen
254
251
  if @results_showing
255
252
  this.result_clear_highlight()
256
253
 
257
- unless @is_multiple
258
- @selected_item.insert top: @search_field
259
- @search_field.focus()
260
-
261
254
  @container.removeClassName "chosen-with-drop"
262
255
  @form_field.fire("chosen:hiding_dropdown", {chosen: this})
263
256
 
@@ -365,7 +358,6 @@ class @Chosen extends AbstractChosen
365
358
 
366
359
  @form_field.options[item.options_index].selected = true
367
360
  @selected_option_count = null
368
- @search_field.value = ""
369
361
 
370
362
  if @is_multiple
371
363
  this.choice_build item
@@ -373,7 +365,11 @@ class @Chosen extends AbstractChosen
373
365
  this.single_set_selected_text(this.choice_label(item))
374
366
 
375
367
  if @is_multiple && (!@hide_results_on_select || (evt.metaKey or evt.ctrlKey))
376
- 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()
377
373
  else
378
374
  this.results_hide()
379
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]*"
@@ -332,12 +332,12 @@ class AbstractChosen
332
332
  get_single_html: ->
333
333
  """
334
334
  <a class="chosen-single chosen-default">
335
- <input class="chosen-search-input" type="text" autocomplete="off" />
336
335
  <span>#{@default_text}</span>
337
336
  <div><b></b></div>
338
337
  </a>
339
338
  <div class="chosen-drop">
340
339
  <div class="chosen-search">
340
+ <input class="chosen-search-input" type="text" autocomplete="off" />
341
341
  </div>
342
342
  <ul class="chosen-results"></ul>
343
343
  </div>
@@ -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 {
@@ -22,10 +22,12 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
22
22
  border-top: 0;
23
23
  background: #fff;
24
24
  box-shadow: 0 4px 5px rgba(#000,.15);
25
- display: none;
25
+ clip: rect(0,0,0,0);
26
+ clip-path: inset(100% 100%);
26
27
  }
27
28
  &.chosen-with-drop .chosen-drop {
28
- display: block;
29
+ clip: auto;
30
+ clip-path: none;
29
31
  }
30
32
  a{
31
33
  cursor: pointer;
@@ -67,12 +69,6 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
67
69
  text-decoration: none;
68
70
  white-space: nowrap;
69
71
  line-height: 24px;
70
-
71
- input[type="text"] {
72
- cursor: pointer;
73
- opacity: 0;
74
- position: absolute;
75
- }
76
72
  }
77
73
  .chosen-default {
78
74
  color: #999;
@@ -146,6 +142,7 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
146
142
  &.chosen-container-single-nosearch .chosen-search {
147
143
  position: absolute;
148
144
  clip: rect(0,0,0,0);
145
+ clip-path: inset(100% 100%);
149
146
  }
150
147
  }
151
148
  /* @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.3
4
+ version: 1.8.7
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: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.6.13
150
+ rubygems_version: 2.7.6
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Integrate Chosen javascript library with Rails asset pipeline