Class: Railspress::Admin::DashboardController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/railspress/admin/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/railspress/admin/dashboard_controller.rb', line 4

def index
  @posts_count = Post.count
  @categories_count = Category.count
  @tags_count = Tag.count
  @recent_posts = Post.ordered.limit(5)

  if Railspress.cms_enabled?
    @content_groups_count = ContentGroup.active.count
    @content_elements_count = ContentElement.active.count
    @recent_content_elements = ContentElement.active.includes(:content_group).order(updated_at: :desc).limit(5)
  end
end