Sha256: 8843a58a2df6aad2c408c256a5d7f5d8832febde18d0a6ea0bae3de6ba9518ab

Contents?: true

Size: 988 Bytes

Versions: 17

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  class StatsController < ApplicationController
    include Hyrax::SingularSubresourceController
    include Hyrax::Breadcrumbs

    before_action :build_breadcrumbs, only: [:work, :file]

    def work
      @document = ::SolrDocument.find(params[:id])
      @pageviews = Hyrax::Analytics.daily_events_for_id(@document.id, 'work-view')
      @downloads = Hyrax::Analytics.daily_events_for_id(@document.id, 'file-set-in-work-download')
    end

    def file
      @stats = Hyrax::FileUsage.new(params[:id])
    end

    private

    def add_breadcrumb_for_controller
      add_breadcrumb I18n.t('hyrax.dashboard.my.works'), hyrax.my_works_path
    end

    def add_breadcrumb_for_action
      case action_name
      when 'file'
        add_breadcrumb I18n.t("hyrax.file_set.browse_view"), main_app.hyrax_file_set_path(params["id"])
      when 'work'
        add_breadcrumb @work.to_s, main_app.polymorphic_path(@work)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hyrax-5.0.1 app/controllers/hyrax/stats_controller.rb
hyrax-5.0.0 app/controllers/hyrax/stats_controller.rb
hyrax-5.0.0.rc3 app/controllers/hyrax/stats_controller.rb
hyrax-5.0.0.rc2 app/controllers/hyrax/stats_controller.rb
hyrax-5.0.0.rc1 app/controllers/hyrax/stats_controller.rb
hyrax-3.6.0 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0.rc3 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0.rc2 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0.rc1 app/controllers/hyrax/stats_controller.rb
hyrax-3.5.0 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0.beta2 app/controllers/hyrax/stats_controller.rb
hyrax-3.4.2 app/controllers/hyrax/stats_controller.rb
hyrax-4.0.0.beta1 app/controllers/hyrax/stats_controller.rb
hyrax-3.4.1 app/controllers/hyrax/stats_controller.rb
hyrax-3.4.0 app/controllers/hyrax/stats_controller.rb
hyrax-3.3.0 app/controllers/hyrax/stats_controller.rb