Module: Hyrax::Admin::StatsBehavior

Extended by:
ActiveSupport::Concern
Included in:
StatsController
Defined in:
app/controllers/concerns/hyrax/admin/stats_behavior.rb

Overview

Examples:

using a custom presenter and stats services

class MyStatsController < ApplicationController
  include Hyrax::Admin::StatsBehavior

  self.admin_stats_presenter = MyCustomStatsPresenter
  self.admin_stats_services = { by_depositor:      CustomDepositorService,
                                depositor_summary: CustomSummaryService }
  # see AdminStatsPresenter#initialize for supported services
end

Instance Method Summary collapse

Instance Method Details

#showObject



25
26
27
28
29
30
31
32
33
# File 'app/controllers/concerns/hyrax/admin/stats_behavior.rb', line 25

def show
  authorize! :read, Hyrax::Statistics
  stats_filters = params.fetch(:stats_filters, {})
  limit = params.fetch(:limit, "5").to_i
  @presenter = build_presenter(stats_filters, limit)
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.admin.sidebar.statistics'), hyrax.admin_stats_path
end