chosen-rails 1.3.0 → 1.4.1
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 +6 -3
- data/vendor/assets/javascripts/chosen.proto.coffee +5 -3
- data/vendor/assets/javascripts/lib/abstract-chosen.coffee +9 -7
- data/vendor/assets/javascripts/lib/select-parser.coffee +2 -0
- 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: 54b231f0aa24b8fc17fd9a9d54d8464bbfd05303
|
4
|
+
data.tar.gz: 467cff16f714c0c296cd038e3e859b070e6b1805
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32ff81721fc53de4f563c8aa3c61d75f6992d46f57053d523eb21de5a1b708df651656f5b1b76eedb086f98a10f5d2a44717c3589a77d05a062e5baf66e651ff
|
7
|
+
data.tar.gz: 13edc3f00dde02e5cf65c3aa38c198e1b9c5bd33baba537ec4890af3a7b8bdc073cb766e3252361adb46f8166feffa947c76fe4367cc0440b8894dff25d65347
|
data/lib/chosen-rails/version.rb
CHANGED
@@ -68,8 +68,8 @@ class Chosen extends AbstractChosen
|
|
68
68
|
@form_field_jq.trigger("chosen:ready", {chosen: this})
|
69
69
|
|
70
70
|
register_observers: ->
|
71
|
-
@container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt);
|
72
|
-
@container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt);
|
71
|
+
@container.bind 'touchstart.chosen', (evt) => this.container_mousedown(evt); evt.preventDefault()
|
72
|
+
@container.bind 'touchend.chosen', (evt) => this.container_mouseup(evt); evt.preventDefault()
|
73
73
|
|
74
74
|
@container.bind 'mousedown.chosen', (evt) => this.container_mousedown(evt); return
|
75
75
|
@container.bind 'mouseup.chosen', (evt) => this.container_mouseup(evt); return
|
@@ -362,6 +362,9 @@ class Chosen extends AbstractChosen
|
|
362
362
|
|
363
363
|
@form_field_jq.trigger "change", {'selected': @form_field.options[item.options_index].value} if @is_multiple || @form_field.selectedIndex != @current_selectedIndex
|
364
364
|
@current_selectedIndex = @form_field.selectedIndex
|
365
|
+
|
366
|
+
evt.preventDefault()
|
367
|
+
|
365
368
|
this.search_field_scale()
|
366
369
|
|
367
370
|
single_set_selected_text: (text=@default_text) ->
|
@@ -398,7 +401,7 @@ class Chosen extends AbstractChosen
|
|
398
401
|
@selected_item.addClass("chosen-single-with-deselect")
|
399
402
|
|
400
403
|
get_search_text: ->
|
401
|
-
|
404
|
+
$('<div/>').text($.trim(@search_field.val())).html()
|
402
405
|
|
403
406
|
winnow_results_set_highlight: ->
|
404
407
|
selected_results = if not @is_multiple then @search_results.find(".result-selected.active-result") else []
|
@@ -51,8 +51,8 @@ class @Chosen extends AbstractChosen
|
|
51
51
|
@form_field.fire("chosen:ready", {chosen: this})
|
52
52
|
|
53
53
|
register_observers: ->
|
54
|
-
@container.observe "touchstart", (evt) => this.container_mousedown(evt)
|
55
|
-
@container.observe "touchend", (evt) => this.container_mouseup(evt)
|
54
|
+
@container.observe "touchstart", (evt) => this.container_mousedown(evt); evt.preventDefault()
|
55
|
+
@container.observe "touchend", (evt) => this.container_mouseup(evt); evt.preventDefault()
|
56
56
|
|
57
57
|
@container.observe "mousedown", (evt) => this.container_mousedown(evt)
|
58
58
|
@container.observe "mouseup", (evt) => this.container_mouseup(evt)
|
@@ -358,6 +358,8 @@ class @Chosen extends AbstractChosen
|
|
358
358
|
@form_field.simulate("change") if typeof Event.simulate is 'function' && (@is_multiple || @form_field.selectedIndex != @current_selectedIndex)
|
359
359
|
@current_selectedIndex = @form_field.selectedIndex
|
360
360
|
|
361
|
+
evt.preventDefault()
|
362
|
+
|
361
363
|
this.search_field_scale()
|
362
364
|
|
363
365
|
single_set_selected_text: (text=@default_text) ->
|
@@ -393,7 +395,7 @@ class @Chosen extends AbstractChosen
|
|
393
395
|
@selected_item.addClassName("chosen-single-with-deselect")
|
394
396
|
|
395
397
|
get_search_text: ->
|
396
|
-
|
398
|
+
@search_field.value.strip().escapeHTML()
|
397
399
|
|
398
400
|
winnow_results_set_highlight: ->
|
399
401
|
if not @is_multiple
|
@@ -77,7 +77,7 @@ class AbstractChosen
|
|
77
77
|
if data.selected and @is_multiple
|
78
78
|
this.choice_build data
|
79
79
|
else if data.selected and not @is_multiple
|
80
|
-
this.single_set_selected_text(data
|
80
|
+
this.single_set_selected_text(this.choice_label(data))
|
81
81
|
|
82
82
|
content
|
83
83
|
|
@@ -97,6 +97,7 @@ class AbstractChosen
|
|
97
97
|
option_el.style.cssText = option.style
|
98
98
|
option_el.setAttribute("data-option-array-index", option.array_index)
|
99
99
|
option_el.innerHTML = option.search_text
|
100
|
+
option_el.title = option.title if option.title
|
100
101
|
|
101
102
|
this.outerHTML(option_el)
|
102
103
|
|
@@ -111,6 +112,7 @@ class AbstractChosen
|
|
111
112
|
group_el = document.createElement("li")
|
112
113
|
group_el.className = classes.join(" ")
|
113
114
|
group_el.innerHTML = group.search_text
|
115
|
+
group_el.title = group.title if group.title
|
114
116
|
|
115
117
|
this.outerHTML(group_el)
|
116
118
|
|
@@ -162,10 +164,10 @@ class AbstractChosen
|
|
162
164
|
results_group = @results_data[option.group_array_index]
|
163
165
|
results += 1 if results_group.active_options is 0 and results_group.search_match
|
164
166
|
results_group.active_options += 1
|
165
|
-
|
166
|
-
unless option.group and not @group_search
|
167
167
|
|
168
|
-
|
168
|
+
option.search_text = if option.group then option.label else option.html
|
169
|
+
|
170
|
+
unless option.group and not @group_search
|
169
171
|
option.search_match = this.search_string_match(option.search_text, regex)
|
170
172
|
results += 1 if option.search_match and not option.group
|
171
173
|
|
@@ -176,7 +178,7 @@ class AbstractChosen
|
|
176
178
|
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
|
177
179
|
|
178
180
|
results_group.group_match = true if results_group?
|
179
|
-
|
181
|
+
|
180
182
|
else if option.group_array_index? and @results_data[option.group_array_index].search_match
|
181
183
|
option.search_match = true
|
182
184
|
|
@@ -210,7 +212,7 @@ class AbstractChosen
|
|
210
212
|
@selected_option_count = 0
|
211
213
|
for option in @form_field.options
|
212
214
|
@selected_option_count += 1 if option.selected
|
213
|
-
|
215
|
+
|
214
216
|
return @selected_option_count
|
215
217
|
|
216
218
|
choices_click: (evt) ->
|
@@ -268,7 +270,7 @@ class AbstractChosen
|
|
268
270
|
tmp.appendChild(element)
|
269
271
|
tmp.innerHTML
|
270
272
|
|
271
|
-
# class methods and variables ============================================================
|
273
|
+
# class methods and variables ============================================================
|
272
274
|
|
273
275
|
@browser_is_supported: ->
|
274
276
|
if window.navigator.appName == "Microsoft Internet Explorer"
|
@@ -16,6 +16,7 @@ class SelectParser
|
|
16
16
|
array_index: group_position
|
17
17
|
group: true
|
18
18
|
label: this.escapeExpression(group.label)
|
19
|
+
title: group.title if group.title
|
19
20
|
children: 0
|
20
21
|
disabled: group.disabled,
|
21
22
|
classes: group.className
|
@@ -32,6 +33,7 @@ class SelectParser
|
|
32
33
|
value: option.value
|
33
34
|
text: option.text
|
34
35
|
html: option.innerHTML
|
36
|
+
title: option.title if option.title
|
35
37
|
selected: option.selected
|
36
38
|
disabled: if group_disabled is true then group_disabled else option.disabled
|
37
39
|
group_array_index: group_position
|
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.
|
4
|
+
version: 1.4.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: 2015-
|
11
|
+
date: 2015-03-11 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.
|
160
|
+
rubygems_version: 2.4.6
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: Integrate Chosen javascript library with Rails asset pipeline
|