chosen-rails 1.1.0 → 1.1.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 +4 -4
- data/lib/chosen-rails/version.rb +1 -1
- data/vendor/assets/images/chosen-sprite.png +0 -0
- data/vendor/assets/images/chosen-sprite@2x.png +0 -0
- data/vendor/assets/javascripts/chosen.jquery.coffee +10 -5
- data/vendor/assets/javascripts/chosen.proto.coffee +8 -2
- data/vendor/assets/javascripts/lib/abstract-chosen.coffee +6 -3
- data/vendor/assets/stylesheets/chosen.css.scss +16 -9
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8d3a949eb004b24858d4e3f930c3d0976b97e29
|
4
|
+
data.tar.gz: 6963256ddcfd39e8fd0c3051c7b53d6aa97ede9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6e1573259de201e500b9b405abd3e659aef0026477f213925057f3d6eef6fadc553b388461eb62e85cea46179e71d561dac83d4cf7c2b149650352a7bdc8d32
|
7
|
+
data.tar.gz: 019031090968431f9d8833efec9af87cb913549bb8e607e1dc2f77491bf09aa6414256c62856746e0e55b5276aa1bdfb607c8bfeb367d823f8d75b1648236b6a
|
data/lib/chosen-rails/version.rb
CHANGED
Binary file
|
Binary file
|
@@ -8,9 +8,9 @@ $.fn.extend({
|
|
8
8
|
this.each (input_field) ->
|
9
9
|
$this = $ this
|
10
10
|
chosen = $this.data('chosen')
|
11
|
-
if options is 'destroy' && chosen
|
11
|
+
if options is 'destroy' && chosen instanceof Chosen
|
12
12
|
chosen.destroy()
|
13
|
-
else unless chosen
|
13
|
+
else unless chosen instanceof Chosen
|
14
14
|
$this.data('chosen', new Chosen(this, options))
|
15
15
|
|
16
16
|
return
|
@@ -66,6 +66,9 @@ class Chosen extends AbstractChosen
|
|
66
66
|
@form_field_jq.trigger("chosen:ready", {chosen: this})
|
67
67
|
|
68
68
|
register_observers: ->
|
69
|
+
@container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); return
|
70
|
+
@container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); return
|
71
|
+
|
69
72
|
@container.bind 'mousedown.chosen', (evt) => this.container_mousedown(evt); return
|
70
73
|
@container.bind 'mouseup.chosen', (evt) => this.container_mouseup(evt); return
|
71
74
|
@container.bind 'mouseenter.chosen', (evt) => this.mouse_enter(evt); return
|
@@ -138,7 +141,7 @@ class Chosen extends AbstractChosen
|
|
138
141
|
this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
|
139
142
|
|
140
143
|
search_results_mousewheel: (evt) ->
|
141
|
-
delta = -evt.originalEvent.wheelDelta or evt.originalEvent.detail if evt.originalEvent
|
144
|
+
delta = evt.originalEvent.deltaY or -evt.originalEvent.wheelDelta or evt.originalEvent.detail if evt.originalEvent
|
142
145
|
if delta?
|
143
146
|
evt.preventDefault()
|
144
147
|
delta = delta * 40 if evt.type is 'DOMMouseScroll'
|
@@ -396,7 +399,6 @@ class Chosen extends AbstractChosen
|
|
396
399
|
if @search_field.val() is @default_text then "" else $('<div/>').text($.trim(@search_field.val())).html()
|
397
400
|
|
398
401
|
winnow_results_set_highlight: ->
|
399
|
-
|
400
402
|
selected_results = if not @is_multiple then @search_results.find(".result-selected.active-result") else []
|
401
403
|
do_high = if selected_results.length then selected_results.first() else @search_results.find(".active-result").first()
|
402
404
|
|
@@ -463,7 +465,10 @@ class Chosen extends AbstractChosen
|
|
463
465
|
@mouse_on_container = false
|
464
466
|
break
|
465
467
|
when 13
|
466
|
-
evt.preventDefault()
|
468
|
+
evt.preventDefault() if this.results_showing
|
469
|
+
break
|
470
|
+
when 32
|
471
|
+
evt.preventDefault() if @disable_search
|
467
472
|
break
|
468
473
|
when 38
|
469
474
|
evt.preventDefault()
|
@@ -49,6 +49,9 @@ class @Chosen extends AbstractChosen
|
|
49
49
|
@form_field.fire("chosen:ready", {chosen: this})
|
50
50
|
|
51
51
|
register_observers: ->
|
52
|
+
@container.observe "touchstart", (evt) => this.container_mousedown(evt)
|
53
|
+
@container.observe "touchend", (evt) => this.container_mouseup(evt)
|
54
|
+
|
52
55
|
@container.observe "mousedown", (evt) => this.container_mousedown(evt)
|
53
56
|
@container.observe "mouseup", (evt) => this.container_mouseup(evt)
|
54
57
|
@container.observe "mouseenter", (evt) => this.mouse_enter(evt)
|
@@ -134,7 +137,7 @@ class @Chosen extends AbstractChosen
|
|
134
137
|
this.results_reset(evt) if evt.target.nodeName is "ABBR" and not @is_disabled
|
135
138
|
|
136
139
|
search_results_mousewheel: (evt) ->
|
137
|
-
delta = -evt.wheelDelta or evt.detail
|
140
|
+
delta = evt.deltaY or -evt.wheelDelta or evt.detail
|
138
141
|
if delta?
|
139
142
|
evt.preventDefault()
|
140
143
|
delta = delta * 40 if evt.type is 'DOMMouseScroll'
|
@@ -462,7 +465,10 @@ class @Chosen extends AbstractChosen
|
|
462
465
|
@mouse_on_container = false
|
463
466
|
break
|
464
467
|
when 13
|
465
|
-
evt.preventDefault()
|
468
|
+
evt.preventDefault() if this.results_showing
|
469
|
+
break
|
470
|
+
when 32
|
471
|
+
evt.preventDefault() if @disable_search
|
466
472
|
break
|
467
473
|
when 38
|
468
474
|
evt.preventDefault()
|
@@ -131,9 +131,8 @@ class AbstractChosen
|
|
131
131
|
|
132
132
|
searchText = this.get_search_text()
|
133
133
|
escapedSearchText = searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
|
134
|
-
regexAnchor = if @search_contains then "" else "^"
|
135
|
-
regex = new RegExp(regexAnchor + escapedSearchText, 'i')
|
136
134
|
zregex = new RegExp(escapedSearchText, 'i')
|
135
|
+
regex = this.get_search_regex(escapedSearchText)
|
137
136
|
|
138
137
|
for option in @results_data
|
139
138
|
|
@@ -153,7 +152,7 @@ class AbstractChosen
|
|
153
152
|
|
154
153
|
unless option.group and not @group_search
|
155
154
|
|
156
|
-
option.search_text = if option.group then option.label else option.
|
155
|
+
option.search_text = if option.group then option.label else option.text
|
157
156
|
option.search_match = this.search_string_match(option.search_text, regex)
|
158
157
|
results += 1 if option.search_match and not option.group
|
159
158
|
|
@@ -177,6 +176,10 @@ class AbstractChosen
|
|
177
176
|
this.update_results_content this.results_option_build()
|
178
177
|
this.winnow_results_set_highlight()
|
179
178
|
|
179
|
+
get_search_regex: (escaped_search_string) ->
|
180
|
+
regex_anchor = if @search_contains then "" else "^"
|
181
|
+
new RegExp(regex_anchor + escaped_search_string, 'i')
|
182
|
+
|
180
183
|
search_string_match: (search_string, regex) ->
|
181
184
|
if regex.test search_string
|
182
185
|
return true
|
@@ -14,12 +14,14 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
14
14
|
zoom: 1;
|
15
15
|
*display: inline;
|
16
16
|
@include user-select(none);
|
17
|
+
* {
|
18
|
+
@include box-sizing(border-box);
|
19
|
+
}
|
17
20
|
.chosen-drop {
|
18
21
|
position: absolute;
|
19
22
|
top: 100%;
|
20
23
|
left: -9999px;
|
21
24
|
z-index: 1010;
|
22
|
-
@include box-sizing(border-box);
|
23
25
|
width: 100%;
|
24
26
|
border: 1px solid #aaa;
|
25
27
|
border-top: 0;
|
@@ -42,7 +44,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
42
44
|
display: block;
|
43
45
|
overflow: hidden;
|
44
46
|
padding: 0 0 0 8px;
|
45
|
-
height:
|
47
|
+
height: 25px;
|
46
48
|
border: 1px solid #aaa;
|
47
49
|
border-radius: 5px;
|
48
50
|
background-color: #fff;
|
@@ -104,7 +106,6 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
104
106
|
padding: 3px 4px;
|
105
107
|
white-space: nowrap;
|
106
108
|
input[type="text"] {
|
107
|
-
@include box-sizing(border-box);
|
108
109
|
margin: 1px 0;
|
109
110
|
padding: 4px 20px 4px 5px;
|
110
111
|
width: 100%;
|
@@ -147,6 +148,7 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
147
148
|
padding: 5px 6px;
|
148
149
|
list-style: none;
|
149
150
|
line-height: 15px;
|
151
|
+
word-wrap: break-word;
|
150
152
|
-webkit-touch-callout: none;
|
151
153
|
&.active-result {
|
152
154
|
display: list-item;
|
@@ -188,9 +190,8 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
188
190
|
.chosen-choices {
|
189
191
|
position: relative;
|
190
192
|
overflow: hidden;
|
191
|
-
@include box-sizing(border-box);
|
192
193
|
margin: 0;
|
193
|
-
padding: 0;
|
194
|
+
padding: 0 5px;
|
194
195
|
width: 100%;
|
195
196
|
height: auto !important;
|
196
197
|
height: 1%;
|
@@ -208,8 +209,8 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
208
209
|
white-space: nowrap;
|
209
210
|
input[type="text"] {
|
210
211
|
margin: 1px 0;
|
211
|
-
padding:
|
212
|
-
height:
|
212
|
+
padding: 0;
|
213
|
+
height: 25px;
|
213
214
|
outline: 0;
|
214
215
|
border: 0 !important;
|
215
216
|
background: transparent !important;
|
@@ -223,17 +224,23 @@ $chosen-sprite-retina: image-url('chosen-sprite@2x.png') !default;
|
|
223
224
|
}
|
224
225
|
&.search-choice {
|
225
226
|
position: relative;
|
226
|
-
margin: 3px
|
227
|
+
margin: 3px 5px 3px 0;
|
227
228
|
padding: 3px 20px 3px 5px;
|
228
229
|
border: 1px solid #aaa;
|
230
|
+
max-width: 100%;
|
229
231
|
border-radius: 3px;
|
230
|
-
background-color: #
|
232
|
+
background-color: #eeeeee;
|
231
233
|
@include background-image(linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eee 100%));
|
234
|
+
background-size: 100% 19px;
|
235
|
+
background-repeat: repeat-x;
|
232
236
|
background-clip: padding-box;
|
233
237
|
box-shadow: 0 0 2px #fff inset, 0 1px 0 rgba(#000,.05);
|
234
238
|
color: #333;
|
235
239
|
line-height: 13px;
|
236
240
|
cursor: default;
|
241
|
+
span {
|
242
|
+
word-wrap: break-word;
|
243
|
+
}
|
237
244
|
.search-choice-close {
|
238
245
|
position: absolute;
|
239
246
|
top: 4px;
|
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.1.
|
4
|
+
version: 1.1.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: 2014-
|
11
|
+
date: 2014-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.2.
|
160
|
+
rubygems_version: 2.2.2
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Integrate Chosen javascript library with Rails asset pipeline
|