mirror of
https://github.com/internetee/registry.git
synced 2025-07-01 08:43:37 +02:00
parent
1cd4d2854f
commit
fc134ee7fb
2 changed files with 12 additions and 0 deletions
|
@ -7,4 +7,11 @@ class DefaultFormBuilder < ActionView::Helpers::FormBuilder
|
|||
def money_field(method, options = {})
|
||||
@template.money_field(@object_name, method, objectify_options(options))
|
||||
end
|
||||
|
||||
def language_select(method, choices = nil, options = {}, html_options = {}, &block)
|
||||
options[:selected] = @object.send(method) unless options[:selected]
|
||||
@template.language_select(@object_name, method, choices, objectify_options(options),
|
||||
@default_options.merge(html_options),
|
||||
&block)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,4 +12,9 @@ module FormHelper
|
|||
|
||||
text_field(object_name, method, options)
|
||||
end
|
||||
|
||||
def language_select(object, method, choices = nil, options = {}, html_options = {}, &block)
|
||||
choices = options_for_select({ en: 'English', et: 'Estonian' }.invert, options[:selected])
|
||||
select(object, method, choices, options, html_options, &block)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue