Permalink
Browse files

fixed formtastic integration

  • Loading branch information...
1 parent 74e6fb9 commit 46d335b8b8cb3cfaaa66cd91f6cb2c5084c34142 Jan Schwenzien committed Aug 1, 2011
Showing with 16 additions and 19 deletions.
  1. +16 −19 lib/localized_language_select.rb
View
35 lib/localized_language_select.rb
@@ -120,26 +120,23 @@ def localized_language_select(method, priority_languages = nil, options = {}, ht
end
end
-
-module Formtastic #:nodoc:
-
- class SemanticFormBuilder < ActionView::Helpers::FormBuilder
-
- protected
-
- def language_input(method, options)
- html_options = options.delete(:input_html) || {}
- priority_languages = options.delete(:priority_languages) || []
-
- field_id = generate_html_id(method, "")
- html_options[:id] ||= field_id
- label_options = options_for_label(options)
- label_options[:for] ||= html_options[:id]
-
- label(method, label_options) <<
- localized_language_select(method, priority_languages, strip_formtastic_options(options), html_options)
+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
+ end
end
end

0 comments on commit 46d335b

Please sign in to comment.