combo_box 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/combo_box/action_controller.rb +2 -0
- data/lib/combo_box/generator.rb +17 -1
- metadata +10 -10
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -10,6 +10,8 @@ module ComboBox
|
|
10
10
|
|
11
11
|
# Generates a default action which is the resource for a combo_box.
|
12
12
|
# It generates an helper which takes in account selected columns for displaying.
|
13
|
+
# The label used to display items is based on the used columns. These columns can be
|
14
|
+
# used with I18n. The key used is: +views.combo_boxes.<controller>.<action>+
|
13
15
|
#
|
14
16
|
# @macro [new] options_details
|
15
17
|
# @param [Hash] options Options to build controller action
|
data/lib/combo_box/generator.rb
CHANGED
@@ -135,7 +135,8 @@ module ComboBox
|
|
135
135
|
# order = ", :order=>"+@columns.collect{|column| "#{column[0]} ASC"}.join(', ').inspect
|
136
136
|
# limit = ", :limit=>"+(@options[:limit]||80).to_s
|
137
137
|
joins = @options[:joins] ? ".joins(#{@options[:joins].inspect}).include(#{@options[:joins].inspect})" : ""
|
138
|
-
|
138
|
+
|
139
|
+
order = @options[:order] ? ".order(#{@options[:order].inspect})" : ".order("+@columns.collect{|c| "#{c.sql_name} ASC"}.join(', ').inspect+")"
|
139
140
|
limit = ".limit(#{@options[:limit]||80})"
|
140
141
|
|
141
142
|
partial = @options[:partial]
|
@@ -194,6 +195,21 @@ module ComboBox
|
|
194
195
|
return "::I18n.translate('views.combo_boxes.#{@controller.controller_name}.#{@action_name}', "+@columns.collect{|c| ":#{c.interpolation_key}=>#{c.value_code(record)}"}.join(', ')+", :default=>'"+@columns.collect{|c| "%{#{c.interpolation_key}}"}.join(', ')+"')"
|
195
196
|
end
|
196
197
|
|
198
|
+
def sanitize_conditions(value)
|
199
|
+
if value.is_a? Array
|
200
|
+
if value.size == 1 and value[0].is_a? String
|
201
|
+
value[0].to_s
|
202
|
+
else
|
203
|
+
value.inspect
|
204
|
+
end
|
205
|
+
elsif value.is_a? String
|
206
|
+
'"'+value.gsub('"','\"')+'"'
|
207
|
+
elsif [Date, DateTime].include? value.class
|
208
|
+
'"'+value.to_formatted_s(:db)+'"'
|
209
|
+
else
|
210
|
+
value.to_s
|
211
|
+
end
|
212
|
+
end
|
197
213
|
|
198
214
|
end
|
199
215
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: combo_box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-19 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &19675440 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '3'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *19675440
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: jquery-rails
|
27
|
-
requirement: &
|
27
|
+
requirement: &19674960 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *19674960
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: jeweler
|
38
|
-
requirement: &
|
38
|
+
requirement: &19674480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.6.4
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *19674480
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rcov
|
49
|
-
requirement: &
|
49
|
+
requirement: &19674000 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *19674000
|
58
58
|
description: Adds helpers for Rails views and controller in order to manage 'dynamic
|
59
59
|
select'. It uses jQuery UI as support for inobtrusive use in forms. It's not the
|
60
60
|
classic Autocompleter, its use is limited to belongs_to reflections.
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash:
|
96
|
+
hash: 1493692048347508204
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|