diff options
author | Jeremy Kemper <jeremykemper@gmail.com> | 2014-08-21 22:07:33 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremykemper@gmail.com> | 2014-08-21 22:07:33 -0700 |
commit | 81b14b7c5c32ef1b21227f7f2548685801930201 (patch) | |
tree | 7dc5e8220fd86adbc9f01d90d3212d30baa9f5b4 /actionview/lib/action_view/helpers | |
parent | 7fce2164036dc38e1e3904479c29d5abfe1e7be5 (diff) | |
download | rails-81b14b7c5c32ef1b21227f7f2548685801930201.tar.gz rails-81b14b7c5c32ef1b21227f7f2548685801930201.tar.bz2 rails-81b14b7c5c32ef1b21227f7f2548685801930201.zip |
Revert "Add I18n support for `:placeholder` HTML option is passed to form fields"
Diffstat (limited to 'actionview/lib/action_view/helpers')
-rw-r--r-- | actionview/lib/action_view/helpers/tags/placeholderable.rb | 32 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/tags/text_area.rb | 4 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/tags/text_field.rb | 4 |
3 files changed, 0 insertions, 40 deletions
diff --git a/actionview/lib/action_view/helpers/tags/placeholderable.rb b/actionview/lib/action_view/helpers/tags/placeholderable.rb deleted file mode 100644 index 313aa725c9..0000000000 --- a/actionview/lib/action_view/helpers/tags/placeholderable.rb +++ /dev/null @@ -1,32 +0,0 @@ -module ActionView - module Helpers - module Tags # :nodoc: - module Placeholderable # :nodoc: - def initialize(*) - super - - if tag_value = @options[:placeholder] - object_name = @object_name.gsub(/\[(.*)_attributes\]\[\d+\]/, '.\1') - method_and_value = tag_value.is_a?(TrueClass) ? @method_name : "#{@method_name}.#{tag_value}" - - if object.respond_to?(:to_model) - key = object.class.model_name.i18n_key - i18n_default = ["#{key}.#{method_and_value}".to_sym, ""] - end - - i18n_default ||= "" - placeholder = I18n.t("#{object_name}.#{method_and_value}", :default => i18n_default, :scope => "helpers.placeholder").presence - - placeholder ||= if object && object.class.respond_to?(:human_attribute_name) - object.class.human_attribute_name(method_and_value) - end - - placeholder ||= @method_name.humanize - - @options[:placeholder] = placeholder - end - end - end - end - end -end diff --git a/actionview/lib/action_view/helpers/tags/text_area.rb b/actionview/lib/action_view/helpers/tags/text_area.rb index 69038c1498..9ee83ee7c2 100644 --- a/actionview/lib/action_view/helpers/tags/text_area.rb +++ b/actionview/lib/action_view/helpers/tags/text_area.rb @@ -1,11 +1,7 @@ -require 'action_view/helpers/tags/placeholderable' - module ActionView module Helpers module Tags # :nodoc: class TextArea < Base # :nodoc: - include Placeholderable - def render options = @options.stringify_keys add_default_name_and_id(options) diff --git a/actionview/lib/action_view/helpers/tags/text_field.rb b/actionview/lib/action_view/helpers/tags/text_field.rb index 5c576a20ca..e0b80d81c2 100644 --- a/actionview/lib/action_view/helpers/tags/text_field.rb +++ b/actionview/lib/action_view/helpers/tags/text_field.rb @@ -1,11 +1,7 @@ -require 'action_view/helpers/tags/placeholderable' - module ActionView module Helpers module Tags # :nodoc: class TextField < Base # :nodoc: - include Placeholderable - def render options = @options.stringify_keys options["size"] = options["maxlength"] unless options.key?("size") |