chosen-rails 0.9.8.3 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
data/chosen-rails.gemspec
CHANGED
@@ -16,8 +16,10 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Chosen::Rails::VERSION
|
17
17
|
|
18
18
|
gem.add_dependency "railties", "~> 3.0"
|
19
|
-
gem.add_dependency "
|
19
|
+
gem.add_dependency "coffee-rails", "~> 3.2"
|
20
|
+
gem.add_dependency "sass-rails", "~> 3.2"
|
21
|
+
|
20
22
|
gem.add_development_dependency "bundler", "~> 1.0"
|
21
23
|
gem.add_development_dependency "rails", "~> 3.0"
|
22
|
-
gem.add_development_dependency "
|
24
|
+
gem.add_development_dependency "thor", "~> 0.14"
|
23
25
|
end
|
data/lib/chosen-rails/version.rb
CHANGED
@@ -41,7 +41,7 @@ class Chosen extends AbstractChosen
|
|
41
41
|
if @is_multiple
|
42
42
|
container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
|
43
43
|
else
|
44
|
-
container_div.html '<a href="javascript:void(0)" class="chzn-single chzn-default"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
|
44
|
+
container_div.html '<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>'
|
45
45
|
|
46
46
|
@form_field_jq.hide().after container_div
|
47
47
|
@container = ($ '#' + @container_id)
|
@@ -89,12 +89,13 @@ class Chosen extends AbstractChosen
|
|
89
89
|
@search_field.blur (evt) => this.input_blur(evt)
|
90
90
|
@search_field.keyup (evt) => this.keyup_checker(evt)
|
91
91
|
@search_field.keydown (evt) => this.keydown_checker(evt)
|
92
|
+
@search_field.focus (evt) => this.input_focus(evt)
|
92
93
|
|
93
94
|
if @is_multiple
|
94
95
|
@search_choices.click (evt) => this.choices_click(evt)
|
95
|
-
@search_field.focus (evt) => this.input_focus(evt)
|
96
96
|
else
|
97
97
|
@container.click (evt) => evt.preventDefault() # gobble click of anchor
|
98
|
+
|
98
99
|
|
99
100
|
search_field_disabled: ->
|
100
101
|
@is_disabled = @form_field_jq[0].disabled
|
@@ -135,10 +136,6 @@ class Chosen extends AbstractChosen
|
|
135
136
|
close_field: ->
|
136
137
|
$(document).unbind "click", @click_test_action
|
137
138
|
|
138
|
-
if not @is_multiple
|
139
|
-
@selected_item.attr "tabindex", @search_field.attr("tabindex")
|
140
|
-
@search_field.attr "tabindex", -1
|
141
|
-
|
142
139
|
@active_field = false
|
143
140
|
this.results_hide()
|
144
141
|
|
@@ -150,10 +147,6 @@ class Chosen extends AbstractChosen
|
|
150
147
|
this.search_field_scale()
|
151
148
|
|
152
149
|
activate_field: ->
|
153
|
-
if not @is_multiple and not @active_field
|
154
|
-
@search_field.attr "tabindex", (@selected_item.attr "tabindex")
|
155
|
-
@selected_item.attr "tabindex", -1
|
156
|
-
|
157
150
|
@container.addClass "chzn-container-active"
|
158
151
|
@active_field = true
|
159
152
|
|
@@ -262,12 +255,7 @@ class Chosen extends AbstractChosen
|
|
262
255
|
if @form_field_jq.attr "tabindex"
|
263
256
|
ti = @form_field_jq.attr "tabindex"
|
264
257
|
@form_field_jq.attr "tabindex", -1
|
265
|
-
|
266
|
-
if @is_multiple
|
267
|
-
@search_field.attr "tabindex", ti
|
268
|
-
else
|
269
|
-
@selected_item.attr "tabindex", ti
|
270
|
-
@search_field.attr "tabindex", -1
|
258
|
+
@search_field.attr "tabindex", ti
|
271
259
|
|
272
260
|
show_search_field_default: ->
|
273
261
|
if @is_multiple and @choices < 1 and not @active_field
|
@@ -282,6 +270,7 @@ class Chosen extends AbstractChosen
|
|
282
270
|
if target.length
|
283
271
|
@result_highlight = target
|
284
272
|
this.result_select(evt)
|
273
|
+
@search_field.focus()
|
285
274
|
|
286
275
|
search_results_mouseover: (evt) ->
|
287
276
|
target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
|
@@ -17,7 +17,7 @@ class Chosen extends AbstractChosen
|
|
17
17
|
super()
|
18
18
|
|
19
19
|
# HTML Templates
|
20
|
-
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
|
20
|
+
@single_temp = new Template('<a href="javascript:void(0)" class="chzn-single chzn-default" tabindex="-1"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" autocomplete="off" /></div><ul class="chzn-results"></ul></div>')
|
21
21
|
@multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" autocomplete="off" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
|
22
22
|
@choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
|
23
23
|
@choice_noclose_temp = new Template('<li class="search-choice search-choice-disabled" id="#{id}"><span>#{choice}</span></li>')
|
@@ -81,10 +81,10 @@ class Chosen extends AbstractChosen
|
|
81
81
|
@search_field.observe "blur", (evt) => this.input_blur(evt)
|
82
82
|
@search_field.observe "keyup", (evt) => this.keyup_checker(evt)
|
83
83
|
@search_field.observe "keydown", (evt) => this.keydown_checker(evt)
|
84
|
+
@search_field.observe "focus", (evt) => this.input_focus(evt)
|
84
85
|
|
85
86
|
if @is_multiple
|
86
87
|
@search_choices.observe "click", (evt) => this.choices_click(evt)
|
87
|
-
@search_field.observe "focus", (evt) => this.input_focus(evt)
|
88
88
|
else
|
89
89
|
@container.observe "click", (evt) => evt.preventDefault() # gobble click of anchor
|
90
90
|
|
@@ -126,10 +126,6 @@ class Chosen extends AbstractChosen
|
|
126
126
|
close_field: ->
|
127
127
|
document.stopObserving "click", @click_test_action
|
128
128
|
|
129
|
-
if not @is_multiple
|
130
|
-
@selected_item.tabIndex = @search_field.tabIndex
|
131
|
-
@search_field.tabIndex = -1
|
132
|
-
|
133
129
|
@active_field = false
|
134
130
|
this.results_hide()
|
135
131
|
|
@@ -141,17 +137,12 @@ class Chosen extends AbstractChosen
|
|
141
137
|
this.search_field_scale()
|
142
138
|
|
143
139
|
activate_field: ->
|
144
|
-
if not @is_multiple and not @active_field
|
145
|
-
@search_field.tabIndex = @selected_item.tabIndex
|
146
|
-
@selected_item.tabIndex = -1
|
147
|
-
|
148
140
|
@container.addClassName "chzn-container-active"
|
149
141
|
@active_field = true
|
150
142
|
|
151
143
|
@search_field.value = @search_field.value
|
152
144
|
@search_field.focus()
|
153
145
|
|
154
|
-
|
155
146
|
test_active_click: (evt) ->
|
156
147
|
if evt.target.up('#' + @container_id)
|
157
148
|
@active_field = true
|
@@ -252,12 +243,7 @@ class Chosen extends AbstractChosen
|
|
252
243
|
if @form_field.tabIndex
|
253
244
|
ti = @form_field.tabIndex
|
254
245
|
@form_field.tabIndex = -1
|
255
|
-
|
256
|
-
if @is_multiple
|
257
|
-
@search_field.tabIndex = ti
|
258
|
-
else
|
259
|
-
@selected_item.tabIndex = ti
|
260
|
-
@search_field.tabIndex = -1
|
246
|
+
@search_field.tabIndex = ti
|
261
247
|
|
262
248
|
show_search_field_default: ->
|
263
249
|
if @is_multiple and @choices < 1 and not @active_field
|
@@ -272,6 +258,7 @@ class Chosen extends AbstractChosen
|
|
272
258
|
if target
|
273
259
|
@result_highlight = target
|
274
260
|
this.result_select(evt)
|
261
|
+
@search_field.focus()
|
275
262
|
|
276
263
|
search_results_mouseover: (evt) ->
|
277
264
|
target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
|
@@ -7,10 +7,9 @@ root = this
|
|
7
7
|
class AbstractChosen
|
8
8
|
|
9
9
|
constructor: (@form_field, @options={}) ->
|
10
|
-
this.set_default_values()
|
11
|
-
|
12
10
|
@is_multiple = @form_field.multiple
|
13
11
|
this.set_default_text()
|
12
|
+
this.set_default_values()
|
14
13
|
|
15
14
|
this.setup()
|
16
15
|
|
@@ -49,7 +48,10 @@ class AbstractChosen
|
|
49
48
|
mouse_leave: -> @mouse_on_container = false
|
50
49
|
|
51
50
|
input_focus: (evt) ->
|
52
|
-
|
51
|
+
if @is_multiple
|
52
|
+
setTimeout (=> this.container_mousedown()), 50 unless @active_field
|
53
|
+
else
|
54
|
+
@activate_field() unless @active_field
|
53
55
|
|
54
56
|
input_blur: (evt) ->
|
55
57
|
if not @mouse_on_container
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chosen-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -28,13 +28,13 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: coffee-rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
37
|
+
version: '3.2'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,23 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
45
|
+
version: '3.2'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sass-rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '3.2'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.2'
|
46
62
|
- !ruby/object:Gem::Dependency
|
47
63
|
name: bundler
|
48
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,13 +92,13 @@ dependencies:
|
|
76
92
|
- !ruby/object:Gem::Version
|
77
93
|
version: '3.0'
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
95
|
+
name: thor
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
81
97
|
none: false
|
82
98
|
requirements:
|
83
99
|
- - ~>
|
84
100
|
- !ruby/object:Gem::Version
|
85
|
-
version: '
|
101
|
+
version: '0.14'
|
86
102
|
type: :development
|
87
103
|
prerelease: false
|
88
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +106,7 @@ dependencies:
|
|
90
106
|
requirements:
|
91
107
|
- - ~>
|
92
108
|
- !ruby/object:Gem::Version
|
93
|
-
version: '
|
109
|
+
version: '0.14'
|
94
110
|
description: Chosen is a javascript library of select box enhancer for jQuery and
|
95
111
|
Protoype. This gem integrates Chosen with Rails asset pipeline for easy of use.
|
96
112
|
email:
|