Sha256: 0ef098ba57dbc881ceb072800db212770f4a4bd2d556149d6b2880c5b46aaaac

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

module ActiveAdmin
  module Dashboards
    class SectionRenderer < ::ActiveAdmin::Renderer

      def to_html(section)
        @section = section
        content_tag :div, title_wrapped + content_wrapped, :class => 'dashboard_section', :id => "#{section.name.to_s.downcase.gsub(' ', '_')}_dashboard_section"
      end

      def title_wrapped
        content_tag :h3, title
      end

      def title
        @section.name.to_s.titleize
      end

      def content_wrapped
        content_tag :div, content, :class => 'dashboard_section_content'
      end

      def content
        instance_eval(&@section.block)
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-0.1.1 lib/active_admin/dashboards/section_renderer.rb
activeadmin-0.1.0 lib/active_admin/dashboards/section_renderer.rb