casein 3.1.5 → 3.1.6
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/PUBLIC_VERSION.yml
CHANGED
@@ -68,19 +68,19 @@ module Casein
|
|
68
68
|
# Styled form tag helpers
|
69
69
|
|
70
70
|
def casein_text_field form, obj, attribute, options = {}
|
71
|
-
casein_form_tag_wrapper(form.text_field(attribute, strip_casein_options(options
|
71
|
+
casein_form_tag_wrapper(form.text_field(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'caseinTextField'))), form, obj, attribute, options).html_safe
|
72
72
|
end
|
73
73
|
|
74
74
|
def casein_password_field form, obj, attribute, options = {}
|
75
|
-
casein_form_tag_wrapper(form.password_field(attribute, strip_casein_options(options
|
75
|
+
casein_form_tag_wrapper(form.password_field(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'caseinTextField'))), form, obj, attribute, options).html_safe
|
76
76
|
end
|
77
77
|
|
78
78
|
def casein_text_area form, obj, attribute, options = {}
|
79
|
-
casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options
|
79
|
+
casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'caseinTextArea'))), form, obj, attribute, options).html_safe
|
80
80
|
end
|
81
81
|
|
82
82
|
def casein_text_area_big form, obj, attribute, options = {}
|
83
|
-
casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options
|
83
|
+
casein_form_tag_wrapper(form.text_area(attribute, strip_casein_options(options_hash_with_merged_classes(options, 'caseinTextAreaBig'))), form, obj, attribute, options).html_safe
|
84
84
|
end
|
85
85
|
|
86
86
|
def casein_check_box form, obj, attribute, options = {}
|
@@ -124,31 +124,32 @@ module Casein
|
|
124
124
|
end
|
125
125
|
|
126
126
|
def casein_select form, obj, attribute, option_tags, options = {}
|
127
|
-
casein_form_tag_wrapper(form.select(attribute, option_tags, strip_casein_options(options),
|
127
|
+
casein_form_tag_wrapper(form.select(attribute, option_tags, strip_casein_options(options), merged_class_hash(options, 'caseinSelect')), form, obj, attribute, options).html_safe
|
128
128
|
end
|
129
129
|
|
130
130
|
def casein_time_zone_select form, obj, attribute, option_tags, options = {}
|
131
|
-
casein_form_tag_wrapper(form.time_zone_select(attribute, option_tags, strip_casein_options(options),
|
131
|
+
casein_form_tag_wrapper(form.time_zone_select(attribute, option_tags, strip_casein_options(options), merged_class_hash(options, 'caseinSelect')), form, obj, attribute, options).html_safe
|
132
132
|
end
|
133
133
|
|
134
134
|
def casein_collection_select form, obj, object, attribute, collection, value_method, text_method, options = {}
|
135
|
-
casein_form_tag_wrapper(collection_select(object, attribute, collection, value_method, text_method, strip_casein_options(options),
|
135
|
+
casein_form_tag_wrapper(collection_select(object, attribute, collection, value_method, text_method, strip_casein_options(options), merged_class_hash(options, 'caseinSelect')), form, obj, attribute, options).html_safe
|
136
136
|
end
|
137
137
|
|
138
138
|
def casein_date_select form, obj, attribute, options = {}
|
139
|
-
casein_form_tag_wrapper(form.date_select(attribute, strip_casein_options(options),
|
139
|
+
casein_form_tag_wrapper(form.date_select(attribute, strip_casein_options(options), merged_class_hash(options, 'caseinDateTimeSelect')), form, obj, attribute, options).html_safe
|
140
140
|
end
|
141
141
|
|
142
142
|
def casein_time_select form, obj, attribute, options = {}
|
143
|
-
casein_form_tag_wrapper(form.time_select(attribute, strip_casein_options(options),
|
143
|
+
casein_form_tag_wrapper(form.time_select(attribute, strip_casein_options(options), merged_class_hash(options, 'caseinDateTimeSelect')), form, obj, attribute, options).html_safe
|
144
144
|
end
|
145
145
|
|
146
146
|
def casein_datetime_select form, obj, attribute, options = {}
|
147
|
-
casein_form_tag_wrapper(form.datetime_select(attribute, strip_casein_options(options),
|
147
|
+
casein_form_tag_wrapper(form.datetime_select(attribute, strip_casein_options(options), merged_class_hash(options, 'caseinDateTimeSelect')), form, obj, attribute, options).html_safe
|
148
148
|
end
|
149
149
|
|
150
150
|
def casein_file_field form, obj, object_name, attribute, options = {}
|
151
|
-
|
151
|
+
class_hash = merged_class_hash(options, 'caseinFileFieldContainer')
|
152
|
+
contents = "<div class='#{class_hash['class']}'>" + file_field(object_name, attribute, strip_casein_options(options)) + '</div>'
|
152
153
|
casein_form_tag_wrapper(contents, form, obj, attribute, options).html_safe
|
153
154
|
end
|
154
155
|
|
@@ -161,6 +162,22 @@ module Casein
|
|
161
162
|
def strip_casein_options options
|
162
163
|
options.reject {|key, value| key.to_s.include? "casein_" }
|
163
164
|
end
|
165
|
+
|
166
|
+
def merged_class_hash options, new_class
|
167
|
+
if options.key? :class
|
168
|
+
new_class += " #{options[:class]}"
|
169
|
+
end
|
170
|
+
|
171
|
+
{:class => new_class}
|
172
|
+
end
|
173
|
+
|
174
|
+
def options_hash_with_merged_classes options, new_class
|
175
|
+
if options.key? :class
|
176
|
+
new_class += " #{options[:class]}"
|
177
|
+
end
|
178
|
+
options[:class] = new_class
|
179
|
+
options
|
180
|
+
end
|
164
181
|
|
165
182
|
def casein_form_tag_wrapper form_tag, form, obj, attribute, options = {}
|
166
183
|
unless options.key? :casein_label
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casein
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 3.1.
|
9
|
+
- 6
|
10
|
+
version: 3.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Russell Quinn
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-09-
|
19
|
+
date: 2010-09-08 00:00:00 +02:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|