Permalink
Browse files

Added formtastic helper as advertised in README.

  • Loading branch information...
1 parent 4b89020 commit 5f9eabf414f15b8b175d533fd2e786b4484e3740 @oneiros oneiros committed Mar 22, 2011
Showing with 24 additions and 0 deletions.
  1. +24 −0 lib/localized_language_select.rb
@@ -115,3 +115,27 @@ 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) || self.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)
+ end
+
+ end
+end
+

0 comments on commit 5f9eabf

Please sign in to comment.