qm-acts-as-generic-controller 0.0.16 → 0.0.18
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.
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
gemspec.email = "marcin@saepia.net"
|
10
10
|
gemspec.homepage = "http://q.saepia.net"
|
11
11
|
gemspec.authors = ["Marcin Lewandowski"]
|
12
|
-
gemspec.version = "0.0.
|
12
|
+
gemspec.version = "0.0.18"
|
13
13
|
gemspec.files = Rake::FileList.new [ "MIT-LICENSE", "Rakefile", "lib/*", "app/views/generic_controller/*" ]
|
14
14
|
gemspec.add_dependency "qui-common-helpers", ">= 0.0.7"
|
15
15
|
gemspec.add_dependency "qui-tabs", ">= 0.0.3"
|
@@ -74,9 +74,15 @@
|
|
74
74
|
<%- end -%>
|
75
75
|
|
76
76
|
<%- if mode == :collection and element.is_a? Array -%>
|
77
|
-
|
77
|
+
<%- html = { :id => "ms#{@multiple_select_count}_#{attribute_name}_#{element.last}", :item_class_name => element.class.to_s, :item_id => element.id } %>
|
78
|
+
<%- [:onclick, :onchange].each{ |event| html[event] = item[event] if item.has_key?(event) } -%>
|
79
|
+
|
80
|
+
<%= check_box_tag field_name, element.last, selected, html %>
|
78
81
|
<%- else -%>
|
79
|
-
|
82
|
+
<%- html = { :id => "ms#{@multiple_select_count}_#{table_name}_#{attribute_name}_#{element.id}", :item_class_name => element.class.to_s, :item_id => element.id } %>
|
83
|
+
<%- [:onclick, :onchange].each{ |event| html[event] = item[event] if item.has_key?(event) } -%>
|
84
|
+
|
85
|
+
<%= check_box_tag field_name, element.id, selected, html %>
|
80
86
|
<%- end -%>
|
81
87
|
|
82
88
|
<%- elsif kind == :radio -%>
|
@@ -95,9 +101,15 @@
|
|
95
101
|
<%- end -%>
|
96
102
|
|
97
103
|
<%- if mode == :collection and element.is_a? Array -%>
|
98
|
-
|
104
|
+
<%- html = { :id => "ms#{@multiple_select_count}_#{attribute_name}_#{element.last}", :item_class_name => element.class.to_s, :item_id => element.id } %>
|
105
|
+
<%- [:onclick, :onchange].each{ |event| html[event] = item[event] if item.has_key?(event) } -%>
|
106
|
+
|
107
|
+
<%= radio_button_tag field_name, element.last, selected, html %>
|
99
108
|
<%- else -%>
|
100
|
-
|
109
|
+
<%- html = { :id => "ms#{@multiple_select_count}_#{table_name}_#{attribute_name}_#{element.id}", :item_class_name => element.class.to_s, :item_id => element.id } %>
|
110
|
+
<%- [:onclick, :onchange].each{ |event| html[event] = item[event] if item.has_key?(event) } -%>
|
111
|
+
|
112
|
+
<%= radio_button_tag field_name, element.id, selected, html %>
|
101
113
|
<%- end -%>
|
102
114
|
<%- end -%>
|
103
115
|
|
@@ -3,6 +3,7 @@ module QM
|
|
3
3
|
module ViewIncludes
|
4
4
|
def multiple_select(options = {})
|
5
5
|
options.symbolize_keys!
|
6
|
+
options[:item] ||= {}
|
6
7
|
|
7
8
|
@multiple_select_count ||= 0
|
8
9
|
@multiple_select_count += 1
|
@@ -40,7 +41,8 @@ module QM
|
|
40
41
|
:klass => klass,
|
41
42
|
:table_name => table_name,
|
42
43
|
:record => options[:record],
|
43
|
-
:collection => collection
|
44
|
+
:collection => collection,
|
45
|
+
:item => options[:item] }
|
44
46
|
|
45
47
|
|
46
48
|
elsif options.has_key? :collection and options[:collection].is_a? Array and options.has_key? :field_name and not options[:field_name].nil?
|
@@ -50,7 +52,8 @@ module QM
|
|
50
52
|
:table_name => options[:field_name],
|
51
53
|
:allow_nil => false,
|
52
54
|
:kind => options[:kind],
|
53
|
-
:collection => options[:collection]
|
55
|
+
:collection => options[:collection],
|
56
|
+
:item => options[:item] }
|
54
57
|
|
55
58
|
else
|
56
59
|
raise ArgumentError, "You must pass some variables as multiple_select. Possibilities are: 'field' and 'record' for automatic associations, or 'collection' and 'field_name' just for displaying a set."
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qm-acts-as-generic-controller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 18
|
10
|
+
version: 0.0.18
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marcin Lewandowski
|