chosen-rails 1.8.2 → 1.8.3

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: 84d37ed2825106c6c400858bff7497d7d9319335
4
- data.tar.gz: 6f5a6bbbdf12cf07e6830d3c4ed9f834b6409f5b
3
+ metadata.gz: f599fc9219c82b346546715590bf8d280ec348e2
4
+ data.tar.gz: 560ab65918b5f25d8a7e9c7378ee15cbb9307667
5
5
  SHA512:
6
- metadata.gz: 6e61368b655875ed16a8b99080fb0a2344e249e3ae96121bee97f40f7bda9c060f4d0e6078b8a2bc41fbfe3847e55c456020b4a6fd0150ccdcaf14e76b75aa28
7
- data.tar.gz: c092ae8213173a6e1d357dea55fbb6cdad215a72e09efbcbd628864a48e7aa2d30217b0871f4c2515eb58593c52916940cad55d7641987576a9984c691c51913
6
+ metadata.gz: b5766a27dbb1e75b3136ee2ec30c59bcb4bd66bf520517f692748b8049b0604087089421460ab3bfbdb605469660e724bf49bbcb5bdb46f61cfa4f93d328276b
7
+ data.tar.gz: 88dd198e47d9022f28ebe8ad6ba7e25379a123d76cbe041dfa68e57750aa4669a77c4e53c08fb2cf87524c1049b404102325181e9554da5e86c1c76fce9bbe03
@@ -34,7 +34,7 @@ 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
 
@@ -42,14 +42,14 @@ module Chosen
42
42
  rescue Capybara::ElementNotFound
43
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)
@@ -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.8.3'
4
+ CHOSEN_VERSION = '1.8.3'
5
5
  end
6
6
  end
@@ -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
@@ -243,6 +243,9 @@ 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
+
246
249
  @container.addClass "chosen-with-drop"
247
250
  @results_showing = true
248
251
 
@@ -259,6 +262,10 @@ class Chosen extends AbstractChosen
259
262
  if @results_showing
260
263
  this.result_clear_highlight()
261
264
 
265
+ unless @is_multiple
266
+ @selected_item.prepend @search_field
267
+ @search_field.focus()
268
+
262
269
  @container.removeClass "chosen-with-drop"
263
270
  @form_field_jq.trigger("chosen:hiding_dropdown", {chosen: this})
264
271
 
@@ -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
@@ -235,6 +235,9 @@ 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
+
238
241
  @container.addClassName "chosen-with-drop"
239
242
  @results_showing = true
240
243
 
@@ -251,6 +254,10 @@ class @Chosen extends AbstractChosen
251
254
  if @results_showing
252
255
  this.result_clear_highlight()
253
256
 
257
+ unless @is_multiple
258
+ @selected_item.insert top: @search_field
259
+ @search_field.focus()
260
+
254
261
  @container.removeClassName "chosen-with-drop"
255
262
  @form_field.fire("chosen:hiding_dropdown", {chosen: this})
256
263
 
@@ -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" />
335
336
  <span>#{@default_text}</span>
336
337
  <div><b></b></div>
337
338
  </a>
338
339
  <div class="chosen-drop">
339
340
  <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>
@@ -22,10 +22,10 @@ $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
- clip: rect(0,0,0,0);
25
+ display: none;
26
26
  }
27
27
  &.chosen-with-drop .chosen-drop {
28
- clip: auto;
28
+ display: block;
29
29
  }
30
30
  a{
31
31
  cursor: pointer;
@@ -67,6 +67,12 @@ $chosen-sprite-retina: url('chosen-sprite@2x.png') !default;
67
67
  text-decoration: none;
68
68
  white-space: nowrap;
69
69
  line-height: 24px;
70
+
71
+ input[type="text"] {
72
+ cursor: pointer;
73
+ opacity: 0;
74
+ position: absolute;
75
+ }
70
76
  }
71
77
  .chosen-default {
72
78
  color: #999;
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.8.3
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: 2017-12-20 00:00:00.000000000 Z
11
+ date: 2018-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties