Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

formtastic 2 support

  • Loading branch information...
commit 51cb55294e0eb6a778fdbaf7913fc0ae7a7c84dd 2 parents af6d679 + 12aba5f
@kristianmandrup authored
Showing with 9 additions and 16 deletions.
  1. +9 −16 lib/localized_language_select.rb
View
25 lib/localized_language_select.rb
@@ -120,23 +120,16 @@ def localized_language_select(method, priority_languages = nil, options = {}, ht
end
end
-module Formtastic
- module Inputs
- class LanguageInput
- include Base
- def to_html
- raise "To use the :language input, please install a language_select plugin, like this one: https://github.com/jeanmartin/localized_language_select/blob/master/lib/localized_language_select.rb" unless builder.respond_to?(:language_select)
- input_wrapping do
- label_html <<
- builder.language_select(method, priority_languages, input_options, input_html_options)
- end
- end
-
- def priority_languages
- options[:priority_languages] || []#builder.priority_languages
- end
+class LanguageInput < Formtastic::Inputs::SelectInput
+
+ def collection
+ result = Array.new
+ priority_languages = input_options.delete(:priority_languages) || nil
+ if priority_languages
+ result += LocalizedLanguageSelect::priority_languages_array(priority_languages)
+ result << ["----------", ""]
end
+ result += LocalizedLanguageSelect::localized_languages_array(options)
end
end
-
Please sign in to comment.
Something went wrong with that request. Please try again.