Sha256: 4fc23928d4901c3287547ad571d36b6871aba5b6c9e65af49440c9f5e1ad20ac

Contents?: true

Size: 1.58 KB

Versions: 73

Compression:

Stored size: 1.58 KB

Contents

module ActiveAdmin
  module Views
    module Pages
      class Dashboard < Base

        def main_content
          if assigns[:dashboard_sections] && assigns[:dashboard_sections].any?
            render_sections(assigns[:dashboard_sections])
          else
            default_welcome_section
          end
        end

        protected

        # Dashboards don't have a sidebar
        def build_sidebar; end

        def title
          I18n.t("active_admin.dashboard")
        end

        def render_sections(sections)
          table :class => "dashboard" do
            sections.in_groups_of(3, false).each do |row|
              tr do
                row.each do |section|
                  td do
                    render_section(section)
                  end
                end
              end
            end
          end
        end

        # Renders each section using their renderer
        def render_section(section)
          insert_tag section_renderer(section), section
        end

        def section_renderer(section)
          if section.options[:as]
            view_factory["dashboard_section_as_#{section.options[:as]}"]
          else
            view_factory.dashboard_section
          end
        end

        def default_welcome_section
          div :class => "blank_slate_container", :id => "dashboard_default_message" do
            span :class => "blank_slate" do
              span I18n.t('active_admin.dashboard_welcome.welcome')
              small I18n.t('active_admin.dashboard_welcome.call_to_action')
            end
          end
        end

      end
    end
  end
end

Version data entries

73 entries across 73 versions & 5 rubygems

Version Path
activeadmin-0.6.6 lib/active_admin/views/pages/dashboard.rb
activeadmin-0.6.5 lib/active_admin/views/pages/dashboard.rb
activeadmin-0.6.4 lib/active_admin/views/pages/dashboard.rb
activeadmin-0.6.3 lib/active_admin/views/pages/dashboard.rb
activeadmin-0.6.2 lib/active_admin/views/pages/dashboard.rb
activeadmin-0.6.1 lib/active_admin/views/pages/dashboard.rb
aa-rails4-0.6.0 lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.141 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/lib/active_admin/views/pages/dashboard.rb