chosen-rails 1.0.0 → 1.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91d427273663844aed9bb0c2cb0bcdc406bd6760
|
4
|
+
data.tar.gz: cc52de001598e99c48fd1168288b878a5f1e80fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011093ee7c6f88c5534488c0df597344f6941a21a8d3e089209ff62a070d9f956589125d4133d8fe3f15a90f30c63e9182e4ae12763a7bccf61ca09f24c86aad
|
7
|
+
data.tar.gz: 4d8d00af862a4ce509939bf7971960af0e49a23389c4fb4516e90e6ec4049521e34aaa1e9ab0383486425cb25dab9d31720035498ca3c82d38da8a568ee362fc
|
data/README.md
CHANGED
@@ -12,13 +12,13 @@ Include `chosen-rails` in Gemefile
|
|
12
12
|
|
13
13
|
gem 'chosen-rails'
|
14
14
|
|
15
|
-
For Rails 4 project, it is required to add [compass-rails](https://github.com/Compass/compass-rails) gem explicitly
|
15
|
+
For Rails 4 project, it is required to add [compass-rails](https://github.com/Compass/compass-rails) gem explicitly.
|
16
16
|
|
17
|
+
gem 'compass-rails', github: 'Compass/compass-rails'
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
gem 'compass-rails',
|
21
|
-
```
|
19
|
+
Or use the prerelease gem
|
20
|
+
|
21
|
+
gem 'compass-rails', '~> 2.0.alpha.0'
|
22
22
|
|
23
23
|
Then run `bundle install`
|
24
24
|
|
data/Rakefile
CHANGED
@@ -3,8 +3,8 @@ require 'bundler/gem_tasks'
|
|
3
3
|
require File.expand_path('../lib/chosen-rails/source_file', __FILE__)
|
4
4
|
|
5
5
|
desc "Update with Harvest's Chosen Library"
|
6
|
-
task 'update-chosen', '
|
7
|
-
remote = args['
|
6
|
+
task 'update-chosen', 'repository_url', 'branch' do |task, args|
|
7
|
+
remote = args['repository_url'] || 'https://github.com/harvesthq/chosen'
|
8
8
|
branch = args['branch'] || 'master'
|
9
9
|
files = SourceFile.new
|
10
10
|
files.fetch remote, branch
|
data/lib/chosen-rails/version.rb
CHANGED
@@ -135,7 +135,7 @@ class Chosen extends AbstractChosen
|
|
135
135
|
this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
|
136
136
|
|
137
137
|
search_results_mousewheel: (evt) ->
|
138
|
-
delta = -evt.originalEvent
|
138
|
+
delta = -evt.originalEvent.wheelDelta or evt.originalEvent.detail if evt.originalEvent
|
139
139
|
if delta?
|
140
140
|
evt.preventDefault()
|
141
141
|
delta = delta * 40 if evt.type is 'DOMMouseScroll'
|
@@ -310,8 +310,8 @@ class Chosen extends AbstractChosen
|
|
310
310
|
this.search_field_scale()
|
311
311
|
|
312
312
|
results_reset: ->
|
313
|
+
this.reset_single_select_options()
|
313
314
|
@form_field.options[0].selected = true
|
314
|
-
@selected_option_count = null
|
315
315
|
this.single_set_selected_text()
|
316
316
|
this.show_search_field_default()
|
317
317
|
this.results_reset_cleanup()
|
@@ -335,14 +335,7 @@ class Chosen extends AbstractChosen
|
|
335
335
|
if @is_multiple
|
336
336
|
high.removeClass("active-result")
|
337
337
|
else
|
338
|
-
|
339
|
-
@result_single_selected.removeClass("result-selected")
|
340
|
-
selected_index = @result_single_selected[0].getAttribute('data-option-array-index')
|
341
|
-
@results_data[selected_index].selected = false
|
342
|
-
|
343
|
-
@result_single_selected = high
|
344
|
-
|
345
|
-
high.addClass "result-selected"
|
338
|
+
this.reset_single_select_options()
|
346
339
|
|
347
340
|
item = @results_data[ high[0].getAttribute("data-option-array-index") ]
|
348
341
|
item.selected = true
|
@@ -304,8 +304,8 @@ class @Chosen extends AbstractChosen
|
|
304
304
|
this.search_field_scale()
|
305
305
|
|
306
306
|
results_reset: ->
|
307
|
+
this.reset_single_select_options()
|
307
308
|
@form_field.options[0].selected = true
|
308
|
-
@selected_option_count = null
|
309
309
|
this.single_set_selected_text()
|
310
310
|
this.show_search_field_default()
|
311
311
|
this.results_reset_cleanup()
|
@@ -329,12 +329,7 @@ class @Chosen extends AbstractChosen
|
|
329
329
|
if @is_multiple
|
330
330
|
high.removeClassName("active-result")
|
331
331
|
else
|
332
|
-
|
333
|
-
@result_single_selected.removeClassName("result-selected")
|
334
|
-
selected_index = @result_single_selected.getAttribute('data-option-array-index')
|
335
|
-
@results_data[selected_index].selected = false
|
336
|
-
|
337
|
-
@result_single_selected = high
|
332
|
+
this.reset_single_select_options()
|
338
333
|
|
339
334
|
high.addClassName("result-selected")
|
340
335
|
|
@@ -18,7 +18,6 @@ class AbstractChosen
|
|
18
18
|
@mouse_on_container = false
|
19
19
|
@results_showing = false
|
20
20
|
@result_highlighted = null
|
21
|
-
@result_single_selected = null
|
22
21
|
@allow_single_deselect = if @options.allow_single_deselect? and @form_field.options[0]? and @form_field.options[0].text is "" then @options.allow_single_deselect else false
|
23
22
|
@disable_search_threshold = @options.disable_search_threshold || 0
|
24
23
|
@disable_search = @options.disable_search || false
|
@@ -106,10 +105,13 @@ class AbstractChosen
|
|
106
105
|
this.set_default_text()
|
107
106
|
this.results_reset_cleanup() if not @is_multiple
|
108
107
|
this.result_clear_highlight()
|
109
|
-
@result_single_selected = null
|
110
108
|
this.results_build()
|
111
109
|
this.winnow_results() if @results_showing
|
112
110
|
|
111
|
+
reset_single_select_options: () ->
|
112
|
+
for result in @results_data
|
113
|
+
result.selected = false if result.selected
|
114
|
+
|
113
115
|
results_toggle: ->
|
114
116
|
if @results_showing
|
115
117
|
this.results_hide()
|
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.0.
|
4
|
+
version: 1.0.1
|
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-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|