Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Daniel Mack September 08, 2012
file 80 lines (64 sloc) 2.536 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
ActiveAdmin.register_page "Dashboard" do

  content :title => proc{ I18n.t("active_admin.dashboard") } do

    columns do

      column do
        panel "Recent Orders" do
          table_for Order.complete.order('id desc').limit(10) do
            column("State") {|order| status_tag(order.state) }
            column("Customer"){|order| link_to(order.user.email, admin_customer_path(order.user)) }
            column("Total") {|order| number_to_currency order.total_price }
          end
        end
      end

      column do
        panel "Recent Customers" do
          table_for User.order('id desc').limit(10).each do |customer|
            column(:email) {|customer| link_to(customer.email, admin_customer_path(customer)) }
          end
        end
      end

    end # columns

    columns do

      column do
        panel "ActiveAdmin Demo" do
          div do
            render('/admin/sidebar_links', :model => 'dashboards')
          end

          div do
            br
            text_node %{<iframe src="https://rpm.newrelic.com/public/charts/6VooNO2hKWB" width="500" height="300" scrolling="no" frameborder="no"></iframe>}.html_safe
          end
        end
      end

    end # columns

    # Define your dashboard sections here. Each block will be
    # rendered on the dashboard in the context of the view. So just
    # return the content which you would like to display.
    
    # The dashboard is organized in rows and columns, where each row
    # divides the space for its child columns equally.

    # To start a new row, open a new 'columns' block, and to start a
    # new column, open a new 'colum' block. That way, you can exactly
    # define the position for each content div.

    # == Simple Dashboard Column
    # Here is an example of a simple dashboard column
    #
    # column do
    # panel "Recent Posts" do
    # content_tag :ul do
    # Post.recent(5).collect do |post|
    # content_tag(:li, link_to(post.title, admin_post_path(post)))
    # end.join.html_safe
    # end
    # end
    # end
    
    # == Render Partials
    # The block is rendererd within the context of the view, so you can
    # easily render a partial rather than build content in ruby.
    #
    # column do
    # panel "Recent Posts" do
    # render 'recent_posts' # => this will render /app/views/admin/dashboard/_recent_posts.html.erb
    # end
    # end

  end # content
end
Something went wrong with that request. Please try again.