Skip to content

Adding alias methods so this works with Simple Form #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/localized_language_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def localized_language_select(object, method, priority_languages = nil, options
InstanceTag.new(object, method, self, options.delete(:object)).
to_localized_language_select_tag(priority_languages, options, html_options)
end
alias_method :language_select, :localized_language_select

# Return "named" select and option tags according to given arguments.
# Use +selected_value+ for setting initial value
Expand All @@ -78,6 +79,7 @@ def localized_language_select_tag(name, selected_value = nil, priority_languages
localized_language_options_for_select(selected_value, priority_languages),
{ "name" => name, "id" => name }.update(html_options.stringify_keys)
end
alias_method :language_select_tag, :localized_language_select_tag

# Returns a string of option tags for languages according to locale. Supply the language code in lower-case ('en', 'de')
# as +selected+ to have it marked as the selected option tag.
Expand All @@ -90,6 +92,7 @@ def localized_language_options_for_select(selected = nil, priority_languages = n
end
return language_options + options_for_select(LocalizedLanguageSelect::localized_languages_array(options), selected)
end
alias_method :language_options_for_select, :localized_language_options_for_select

end

Expand All @@ -111,6 +114,7 @@ class FormBuilder
def localized_language_select(method, priority_languages = nil, options = {}, html_options = {})
@template.localized_language_select(@object_name, method, priority_languages, options.merge(:object => @object), html_options)
end
alias_method :language_select, :localized_language_select
end

end
Expand Down