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
Pistos-ramaze-2009.06.12 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.04.18 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.04.22 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.04 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.05.08 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.05 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.06.04 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.06.12 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.06 lib/ramaze/view/nagoro/render_partial.rb
manveru-ramaze-2009.07 lib/ramaze/view/nagoro/render_partial.rb
rjspotter-ramaze-2009.06.29 lib/ramaze/view/nagoro/render_partial.rb
rjspotter-ramaze-2009.06.31 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2012.12.08 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2012.12.08b lib/ramaze/view/nagoro/render_partial.rb
ramaze-2012.04.14 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2012.03.07 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2011.12.28 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2011.10.23 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2011.07.25 lib/ramaze/view/nagoro/render_partial.rb
ramaze-2011.01.30 lib/ramaze/view/nagoro/render_partial.rb