Sha256: a539542aff2dc428b59fa24f4eff818f6170cf34dcd6c401e01adc1e0c5ed6c1

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

# Rails 3.2.3's form helpers add a newline after opening textareas, which can
# cause problems with newlines being considered content rather than markup.
# These changes fix the issue by making the helpers emit "<haml:newline/>"
# rather than the leading newline. The tag is then replaced by a newline after
# rendering.
#
# This should be considered nothing more than an emergency hotfix to ensure
# compatibility with the latest version of Rails, made at a moment when the Haml
# project is transitioning to a new maintainer.

# module AbstractController
#   module Rendering
#     def render_to_body_with_haml(options = {})
#       if rendered = render_to_body_without_haml(options)
#         rendered.gsub('<haml:newline/>', "\n").html_safe
#       end
#     end
#     alias_method_chain :render_to_body, :haml
#   end
# end

module ActionView
  module Helpers

    module FormTagHelper
      def text_area_tag_with_haml(*args)
        text_area_tag_without_haml(*args).sub('>&#x000A;', ">\n").html_safe
      end
      alias_method_chain :text_area_tag, :haml
    end

    module FormHelper
      def text_area_with_haml(*args)
        text_area_without_haml(*args).sub('>&#x000A;', ">\n").html_safe
      end
      alias_method_chain :text_area, :haml
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
haml-4.0.0.rc.1 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.rc.4 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.rc.3 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.rc.2 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.rc.1 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.beta.3 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.beta.2 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.beta.1 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.alpha.14 lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.2.0.alpha.13 lib/haml/helpers/rails_323_textarea_fix.rb