Class: ActionView::Helpers::InstanceTag
- Inherits:
-
Object
- Object
- ActionView::Helpers::InstanceTag
show all
- Includes:
- FormOptionsHelper, CountryHelpers
- Defined in:
- lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/usa_state.rb,
lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/name_option_for_datetime.rb,
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/country_helpers.rb,
lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb
Overview
Constant Summary
FormOptionsHelper::USASTATES
Instance Method Summary
collapse
#usa_state_options_for_select, #usa_state_select
Instance Method Details
187
188
189
190
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 187
def to_input_field_tag(field_type, options={})
field_meth = "#{field_type}_field"
"<%= f.#{field_meth} '#{@method_name}' #{options.empty? ? '' : ', '+options.inspect} %>"
end
|
#to_boolean_checkbox_tag(options = {}) ⇒ Object
167
168
169
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 167
def to_boolean_checkbox_tag(options = {})
"<%= f.check_box '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect} %>"
end
|
#to_boolean_select_tag(options = {}) ⇒ Object
194
195
196
197
198
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 194
def to_boolean_select_tag(options = {})
options = options.stringify_keys
add_default_name_and_id(options)
tag_text = "<%= select \"#{@object_name}\", \"#{@method_name}\", [[\"True\", true], [\"False\", false]], { :selected => @#{@object_name}.#{@method_name} } %>"
end
|
#to_country_select_tag(priority_countries, options, html_options) ⇒ Object
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/country_helpers.rb', line 302
def to_country_select_tag(priority_countries, options, html_options)
html_options = html_options.stringify_keys
html_options['name'] = options[:name]
html_options['id'] = options[:id]
add_default_name_and_id(html_options)
value = value(object)
content_tag("select",
add_options(
country_options_for_select(value, priority_countries),
options, value
), html_options
)
end
|
#to_date_select_tag(options = {}) ⇒ Object
175
176
177
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 175
def to_date_select_tag(options = {})
"<%= f.date_select '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect} %>"
end
|
#to_datetime_select_tag(options = {}) ⇒ Object
179
180
181
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 179
def to_datetime_select_tag(options = {})
"<%= f.datetime_select '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect} %>"
end
|
162
163
164
165
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 162
def to_input_field_tag(field_type, options={})
field_meth = "#{field_type}_field"
"<%= f.#{field_meth} '#{@method_name}' #{options.empty? ? '' : ', '+options.inspect} %>"
end
|
#to_tag(options = {}) ⇒ Object
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 142
def to_tag(options = {})
case column_type
when :string
field_type = @method_name.include?("password") ? "password" : "text"
to_input_field_tag(field_type, options)
when :text
to_text_area_tag(options)
when :integer, :float, :decimal
to_input_field_tag("text", options)
when :date
to_date_select_tag(options)
when :datetime, :timestamp
to_datetime_select_tag(options)
when :time
to_time_select_tag(options)
when :boolean
to_boolean_checkbox_tag(options)
end
end
|
#to_text_area_tag(options = {}) ⇒ Object
171
172
173
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 171
def to_text_area_tag(options = {})
"<%= f.text_area '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect} %>"
end
|
#to_time_select_tag(options = {}) ⇒ Object
183
184
185
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/generators/active_scaffold/active_scaffold_generator.rb', line 183
def to_time_select_tag(options = {})
"<%= f.time_select '#{@method_name}' #{options.empty? ? '' : ', '+ options.inspect} %>"
end
|
#to_usa_state_select_tag(priority_states, options, html_options) ⇒ Object
38
39
40
41
42
43
|
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/lib/extensions/usa_state.rb', line 38
def to_usa_state_select_tag(priority_states, options, html_options)
html_options = html_options.stringify_keys
add_default_name_and_id(html_options)
value = value(object) if method(:value).arity > 0
content_tag("select", add_options(usa_state_options_for_select(value, priority_states), options, value), html_options)
end
|