Sha256: 68c179e4489926a7b984981e689646812bb0fe8444f92900529981333dfba7d7

Contents?: true

Size: 770 Bytes

Versions: 21

Compression:

Stored size: 770 Bytes

Contents

module ActiveAdmin
  module ViewHelpers
    module RendererHelper

      # Adds the ability to render ActiveAdmin::Renderers using the
      # standard render method. 
      #
      # Example:
      #
      #   render MyRendererClass, "Arg1", "Arg2"
      #
      # which is the same as doing
      #
      #   MyRendererClass.new(self).to_html("Arg1", "Arg2")
      def render(*args)
        if args[0].is_a?(Class) && args[0].ancestors.include?(ActiveAdmin::Renderer)
          renderer = args.shift
          renderer.new(self).to_html(*args)
        elsif args[0].is_a?(Class) && args[0].ancestors.include?(Arbre::HTML::Tag)
          tag_class = args.shift
          insert_tag tag_class, *args
        else
          super
        end
      end

    end
  end
end

Version data entries

21 entries across 21 versions & 4 rubygems

Version Path
activeadmin-0.4.4 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.4.3 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.4.2 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.4.1 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.4.0 lib/active_admin/view_helpers/renderer_helper.rb
andrewroth_activeadmin-0.3.4.4 lib/active_admin/view_helpers/renderer_helper.rb
andrewroth_activeadmin-0.3.4.3 lib/active_admin/view_helpers/renderer_helper.rb
andrewroth_activeadmin-0.3.4.2 lib/active_admin/view_helpers/renderer_helper.rb
andrewroth_activeadmin-0.3.4.1 lib/active_admin/view_helpers/renderer_helper.rb
andrewroth_activeadmin-0.3.4 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.3.4 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.3.3 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.3.2 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.3.1 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.3.0 lib/active_admin/view_helpers/renderer_helper.rb
nsm-activeadmin-0.2.2 lib/active_admin/view_helpers/renderer_helper.rb
saulolso-activeadmin-0.2.2.1 lib/active_admin/view_helpers/renderer_helper.rb
saulolso-activeadmin-0.2.2 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.2.2 lib/active_admin/view_helpers/renderer_helper.rb
activeadmin-0.2.1 lib/active_admin/view_helpers/renderer_helper.rb