chosen-rails 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chosen-rails/version.rb +2 -2
- data/vendor/assets/javascripts/chosen.jquery.coffee +9 -6
- data/vendor/assets/javascripts/chosen.proto.coffee +7 -5
- data/vendor/assets/javascripts/lib/abstract-chosen.coffee +3 -0
- data/vendor/assets/stylesheets/chosen.css.scss +9 -10
- metadata +20 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8a95a626b6c7b913748cad6239a1527b7449d6f
|
4
|
+
data.tar.gz: 3b1c9e512b27f2139156fd76d74b0356b93d1967
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25ed41cc0f0027966d5893a7b4136efdf73474e4389074e09e511cae123875900c14b44d0188b97082f84fc0992cb0131b799e4b5d4072520dcf53d6bd1514f7
|
7
|
+
data.tar.gz: 0d265fc7ae16b440f608e8b722aed9adee962308150f8efb0ea3e3daf518db52515937a3423fa8e9ba01f341ca40c7d6aae1523b039a370a32b8c31eaa4039b0
|
data/lib/chosen-rails/version.rb
CHANGED
@@ -89,6 +89,8 @@ class Chosen extends AbstractChosen
|
|
89
89
|
@search_field.bind 'keyup.chosen', (evt) => this.keyup_checker(evt); return
|
90
90
|
@search_field.bind 'keydown.chosen', (evt) => this.keydown_checker(evt); return
|
91
91
|
@search_field.bind 'focus.chosen', (evt) => this.input_focus(evt); return
|
92
|
+
@search_field.bind 'cut.chosen', (evt) => this.clipboard_event_checker(evt); return
|
93
|
+
@search_field.bind 'paste.chosen', (evt) => this.clipboard_event_checker(evt); return
|
92
94
|
|
93
95
|
if @is_multiple
|
94
96
|
@search_choices.bind 'click.chosen', (evt) => this.choices_click(evt); return
|
@@ -96,7 +98,7 @@ class Chosen extends AbstractChosen
|
|
96
98
|
@container.bind 'click.chosen', (evt) -> evt.preventDefault(); return # gobble click of anchor
|
97
99
|
|
98
100
|
destroy: ->
|
99
|
-
$(
|
101
|
+
$(@container[0].ownerDocument).unbind "click.chosen", @click_test_action
|
100
102
|
if @search_field[0].tabIndex
|
101
103
|
@form_field_jq[0].tabIndex = @search_field[0].tabIndex
|
102
104
|
|
@@ -124,7 +126,7 @@ class Chosen extends AbstractChosen
|
|
124
126
|
if not (evt? and ($ evt.target).hasClass "search-choice-close")
|
125
127
|
if not @active_field
|
126
128
|
@search_field.val "" if @is_multiple
|
127
|
-
$(
|
129
|
+
$(@container[0].ownerDocument).bind 'click.chosen', @click_test_action
|
128
130
|
this.results_show()
|
129
131
|
else if not @is_multiple and evt and (($(evt.target)[0] == @selected_item[0]) || $(evt.target).parents("a.chosen-single").length)
|
130
132
|
evt.preventDefault()
|
@@ -146,7 +148,7 @@ class Chosen extends AbstractChosen
|
|
146
148
|
this.close_field() if not @active_field and @container.hasClass "chosen-container-active"
|
147
149
|
|
148
150
|
close_field: ->
|
149
|
-
$(
|
151
|
+
$(@container[0].ownerDocument).unbind "click.chosen", @click_test_action
|
150
152
|
|
151
153
|
@active_field = false
|
152
154
|
this.results_hide()
|
@@ -166,7 +168,8 @@ class Chosen extends AbstractChosen
|
|
166
168
|
|
167
169
|
|
168
170
|
test_active_click: (evt) ->
|
169
|
-
|
171
|
+
active_container = $(evt.target).closest('.chosen-container')
|
172
|
+
if active_container.length and @container[0] == active_container[0]
|
170
173
|
@active_field = true
|
171
174
|
else
|
172
175
|
this.close_field()
|
@@ -225,14 +228,13 @@ class Chosen extends AbstractChosen
|
|
225
228
|
return false
|
226
229
|
|
227
230
|
@container.addClass "chosen-with-drop"
|
228
|
-
@form_field_jq.trigger("chosen:showing_dropdown", {chosen: this})
|
229
|
-
|
230
231
|
@results_showing = true
|
231
232
|
|
232
233
|
@search_field.focus()
|
233
234
|
@search_field.val @search_field.val()
|
234
235
|
|
235
236
|
this.winnow_results()
|
237
|
+
@form_field_jq.trigger("chosen:showing_dropdown", {chosen: this})
|
236
238
|
|
237
239
|
update_results_content: (content) ->
|
238
240
|
@search_results.html content
|
@@ -405,6 +407,7 @@ class Chosen extends AbstractChosen
|
|
405
407
|
no_results_html.find("span").first().html(terms)
|
406
408
|
|
407
409
|
@search_results.append no_results_html
|
410
|
+
@form_field_jq.trigger("chosen:no_results", {chosen:this})
|
408
411
|
|
409
412
|
no_results_clear: ->
|
410
413
|
@search_results.find(".no-results").remove()
|
@@ -73,6 +73,8 @@ class @Chosen extends AbstractChosen
|
|
73
73
|
@search_field.observe "keyup", (evt) => this.keyup_checker(evt)
|
74
74
|
@search_field.observe "keydown", (evt) => this.keydown_checker(evt)
|
75
75
|
@search_field.observe "focus", (evt) => this.input_focus(evt)
|
76
|
+
@search_field.observe "cut", (evt) => this.clipboard_event_checker(evt)
|
77
|
+
@search_field.observe "paste", (evt) => this.clipboard_event_checker(evt)
|
76
78
|
|
77
79
|
if @is_multiple
|
78
80
|
@search_choices.observe "click", (evt) => this.choices_click(evt)
|
@@ -80,7 +82,7 @@ class @Chosen extends AbstractChosen
|
|
80
82
|
@container.observe "click", (evt) => evt.preventDefault() # gobble click of anchor
|
81
83
|
|
82
84
|
destroy: ->
|
83
|
-
|
85
|
+
@container.ownerDocument.stopObserving "click", @click_test_action
|
84
86
|
|
85
87
|
@form_field.stopObserving()
|
86
88
|
@container.stopObserving()
|
@@ -121,7 +123,7 @@ class @Chosen extends AbstractChosen
|
|
121
123
|
if not (evt? and evt.target.hasClassName "search-choice-close")
|
122
124
|
if not @active_field
|
123
125
|
@search_field.clear() if @is_multiple
|
124
|
-
|
126
|
+
@container.ownerDocument.observe "click", @click_test_action
|
125
127
|
this.results_show()
|
126
128
|
else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chosen-single"))
|
127
129
|
this.results_toggle()
|
@@ -142,7 +144,7 @@ class @Chosen extends AbstractChosen
|
|
142
144
|
this.close_field() if not @active_field and @container.hasClassName("chosen-container-active")
|
143
145
|
|
144
146
|
close_field: ->
|
145
|
-
|
147
|
+
@container.ownerDocument.stopObserving "click", @click_test_action
|
146
148
|
|
147
149
|
@active_field = false
|
148
150
|
this.results_hide()
|
@@ -219,14 +221,13 @@ class @Chosen extends AbstractChosen
|
|
219
221
|
return false
|
220
222
|
|
221
223
|
@container.addClassName "chosen-with-drop"
|
222
|
-
@form_field.fire("chosen:showing_dropdown", {chosen: this})
|
223
|
-
|
224
224
|
@results_showing = true
|
225
225
|
|
226
226
|
@search_field.focus()
|
227
227
|
@search_field.value = @search_field.value
|
228
228
|
|
229
229
|
this.winnow_results()
|
230
|
+
@form_field.fire("chosen:showing_dropdown", {chosen: this})
|
230
231
|
|
231
232
|
update_results_content: (content) ->
|
232
233
|
@search_results.update content
|
@@ -400,6 +401,7 @@ class @Chosen extends AbstractChosen
|
|
400
401
|
|
401
402
|
no_results: (terms) ->
|
402
403
|
@search_results.insert @no_results_temp.evaluate( terms: terms )
|
404
|
+
@form_field.fire("chosen:no_results", {chosen: this})
|
403
405
|
|
404
406
|
no_results_clear: ->
|
405
407
|
nr = null
|
@@ -222,6 +222,9 @@ class AbstractChosen
|
|
222
222
|
# don't do anything on these keys
|
223
223
|
else this.results_search()
|
224
224
|
|
225
|
+
clipboard_event_checker: (evt) ->
|
226
|
+
setTimeout (=> this.results_search()), 50
|
227
|
+
|
225
228
|
container_width: ->
|
226
229
|
return if @options.width? then @options.width else "#{@form_field.offsetWidth}px"
|
227
230
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
@import "compass/css3/images";
|
3
3
|
@import "compass/css3/user-interface";
|
4
4
|
|
5
|
-
$chosen-sprite: image-url('chosen-sprite.png');
|
6
|
-
$chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
5
|
+
$chosen-sprite: image-url('chosen-sprite.png') !default;
|
6
|
+
$chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
7
7
|
|
8
8
|
/* @group Base */
|
9
9
|
.chosen-container {
|
@@ -112,7 +112,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
112
112
|
outline: 0;
|
113
113
|
border: 1px solid #aaa;
|
114
114
|
background: #fff $chosen-sprite no-repeat 100% -20px;
|
115
|
-
@include background($chosen-sprite no-repeat 100% -20px
|
115
|
+
@include background($chosen-sprite no-repeat 100% -20px);
|
116
116
|
font-size: 1em;
|
117
117
|
font-family: sans-serif;
|
118
118
|
line-height: normal;
|
@@ -133,6 +133,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
133
133
|
|
134
134
|
/* @group Results */
|
135
135
|
.chosen-container .chosen-results {
|
136
|
+
color: #444;
|
136
137
|
position: relative;
|
137
138
|
overflow-x: hidden;
|
138
139
|
overflow-y: auto;
|
@@ -162,6 +163,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
162
163
|
color: #fff;
|
163
164
|
}
|
164
165
|
&.no-results {
|
166
|
+
color: #777;
|
165
167
|
display: list-item;
|
166
168
|
background: #f4f4f4;
|
167
169
|
}
|
@@ -212,15 +214,12 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
212
214
|
border: 0 !important;
|
213
215
|
background: transparent !important;
|
214
216
|
box-shadow: none;
|
215
|
-
color: #
|
217
|
+
color: #999;
|
216
218
|
font-size: 100%;
|
217
219
|
font-family: sans-serif;
|
218
220
|
line-height: normal;
|
219
221
|
border-radius: 0;
|
220
222
|
}
|
221
|
-
.default {
|
222
|
-
color: #999;
|
223
|
-
}
|
224
223
|
}
|
225
224
|
&.search-choice {
|
226
225
|
position: relative;
|
@@ -230,7 +229,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
230
229
|
border-radius: 3px;
|
231
230
|
background-color: #e4e4e4;
|
232
231
|
@include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
|
233
|
-
background-clip: padding-box;
|
232
|
+
background-clip: padding-box;
|
234
233
|
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(#000,.05);
|
235
234
|
color: #333;
|
236
235
|
line-height: 13px;
|
@@ -303,7 +302,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
303
302
|
border: 1px solid #5897fb;
|
304
303
|
box-shadow: 0 0 5px rgba(#000,.3);
|
305
304
|
li.search-field input[type="text"] {
|
306
|
-
color: #
|
305
|
+
color: #222 !important;
|
307
306
|
}
|
308
307
|
}
|
309
308
|
}
|
@@ -377,7 +376,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png');
|
|
377
376
|
.chosen-search input[type="text"] {
|
378
377
|
padding: 4px 5px 4px 20px;
|
379
378
|
background: #fff $chosen-sprite no-repeat -30px -20px;
|
380
|
-
@include background($chosen-sprite no-repeat -30px -20px
|
379
|
+
@include background($chosen-sprite no-repeat -30px -20px);
|
381
380
|
direction: rtl;
|
382
381
|
}
|
383
382
|
&.chosen-container-single{
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
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.1.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:
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coffee-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '3.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '3.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: sass-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.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
54
|
version: '3.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: compass-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.1.2
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.1.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rails
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: thor
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.14'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.14'
|
111
111
|
description: Chosen is a javascript library of select box enhancer for jQuery and
|
@@ -116,7 +116,7 @@ executables: []
|
|
116
116
|
extensions: []
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
|
-
- .gitignore
|
119
|
+
- ".gitignore"
|
120
120
|
- Gemfile
|
121
121
|
- LICENSE
|
122
122
|
- README.md
|
@@ -147,19 +147,18 @@ require_paths:
|
|
147
147
|
- lib
|
148
148
|
required_ruby_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- -
|
155
|
+
- - ">="
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.2.1
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Integrate Chosen javascript library with Rails asset pipeline
|
164
164
|
test_files: []
|
165
|
-
has_rdoc:
|