Sha256: aaa9de3e3e619fd1048a42e84dce84913a71d385559a7ee49faafb76d3b77b74

Contents?: true

Size: 820 Bytes

Versions: 33

Compression:

Stored size: 820 Bytes

Contents

require 'innate/helper/render'

module Nagoro
  module Pipe
    # Pipe that transforms <render /> tags.
    #
    # the src parameter in the render tag will be used as first parameter to
    # render_partial, all other paramters are passed on as +variables+.
    #
    # Example calling render_partial('hello'):
    #   <render src="hello" />
    #
    # Example calling render_partial('hello', 'tail' => 'foo'):
    #   <render src="hello" tail="foo" />
    #
    class RenderPartial < Base
      include Innate::Helper::Render

      def tag_start(tag, attrs)
        if tag == 'render' and action_name = attrs.delete('src')
          append(render_partial(action_name, attrs))
        else
          super
        end
      end

      def tag_end(tag)
        super unless tag == 'render'
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 4 rubygems

Version Path
ramaze-2011.01 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2010.06.18 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2010.04.04 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2010.04 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2010.03 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2010.01 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.10 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.07 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.04 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.05 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.06 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.06.04 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2009.06.12 lib/ramaze/view/nagoro/render_partial.rb