How To: Create a Dashboard Interface - TrestleAdmin/trestle GitHub Wiki
Create a new app/admin/dashboard_admin.rb
file and add the following contents:
Trestle.admin(:dashboard) do
menu do
item :dashboard, icon: "fa fa-tachometer"
end
controller do
def index
@missing_warhead_count = Warhead.missing.count
end
end
end
Note that we are configuring a Trestle.admin
and not a Trestle.resource
.
Then add a view to support it at app/views/admin/dashboard/index.html.haml
:
- content_for(:title, 'Dashboard')
= render "header"
.main-content-area
.main-content-container
.main-content
%h3= pluralize(@missing_warhead_count,'Missing Warhead')