Class: ActiveAdmin::Views::Pages::Dashboard

Inherits:
Base show all
Defined in:
lib/active_admin/views/pages/dashboard.rb

Constant Summary

Constants included from Arbre::HTML

Arbre::HTML::AUTO_BUILD_ELEMENTS, Arbre::HTML::HTML5_ELEMENTS

Instance Attribute Summary

Attributes inherited from Arbre::HTML::Tag

#attributes

Attributes inherited from Arbre::HTML::Element

#children, #parent

Instance Method Summary collapse

Methods inherited from Base

#build

Methods inherited from Arbre::HTML::Document

#build, #build_body, #build_head, #doctype, #document, #tag_name, #to_html

Methods inherited from Arbre::HTML::Tag

#add_class, #build, #class_list, #class_names, #get_attribute, #has_attribute?, #id, #id!, #id=, #initialize, #remove_attribute, #remove_class, #set_attribute, #to_html

Methods inherited from Arbre::HTML::Element

#+, #<<, #add_child, #assigns, #build, builder_method, #content, #content=, #document, #each, #get_elements_by_tag_name, #helpers, #html_safe, #indent_level, #initialize, #parent?, #remove_child, #tag_name, #to_ary, #to_html, #to_s, #to_str

Methods included from Arbre::HTML::BuilderMethods

#build_tag, #current_dom_context, #insert_tag, #insert_text_node_if_string, #with_current_dom_context

Methods included from Arbre::HTML

#current_dom_context, #helpers, #method_missing

Constructor Details

This class inherits a constructor from Arbre::HTML::Tag

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Arbre::HTML

Instance Method Details

#build_sidebarObject (protected)

Dashboards don’t have a sidebar



17
# File 'lib/active_admin/views/pages/dashboard.rb', line 17

def build_sidebar; end

#default_welcome_sectionObject (protected)



50
51
52
53
54
55
56
57
# File 'lib/active_admin/views/pages/dashboard.rb', line 50

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

#main_contentObject



6
7
8
9
10
11
12
# File 'lib/active_admin/views/pages/dashboard.rb', line 6

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

#render_section(section) ⇒ Object (protected)

Renders each section using their renderer



38
39
40
# File 'lib/active_admin/views/pages/dashboard.rb', line 38

def render_section(section)
  insert_tag section_renderer(section), section
end

#render_sections(sections) ⇒ Object (protected)



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/active_admin/views/pages/dashboard.rb', line 23

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

#section_renderer(section) ⇒ Object (protected)



42
43
44
45
46
47
48
# File 'lib/active_admin/views/pages/dashboard.rb', line 42

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

#titleObject (protected)



19
20
21
# File 'lib/active_admin/views/pages/dashboard.rb', line 19

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