Sha256: b0e68375e374bda939674cca0b59e067eccb1eb4b00a901c8ef10a9c35146dee

Contents?: true

Size: 1.29 KB

Versions: 55

Compression:

Stored size: 1.29 KB

Contents

require "abstract_controller/rendering"

# 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

55 entries across 53 versions & 3 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.7.4 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.7.3 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.7.2 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.7.1 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.7.0 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/haml-3.1.8/lib/haml/helpers/rails_323_textarea_fix.rb
haml-3.1.8 lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.9 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.8 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.7 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.6 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.5 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.4 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb
classiccms-0.6.3 vendor/bundle/gems/haml-3.1.6/lib/haml/helpers/rails_323_textarea_fix.rb