Sha256: a57dd9c14df94d4c943073b6aef4f8296bf227a3fb770a54623278e7e9f44089

Contents?: true

Size: 1.62 KB

Versions: 18

Compression:

Stored size: 1.62 KB

Contents

module Spotlight
  ##
  # Exhibit dashboard controller
  class DashboardsController < Spotlight::ApplicationController
    before_action :authenticate_user!
    load_and_authorize_resource :exhibit, class: Spotlight::Exhibit

    include Spotlight::Base
    include Spotlight::Catalog::AccessControlsEnforcement

    before_action only: [:show] do
      blacklight_config.view.reject! { |_k, _v| true }
      blacklight_config.view.admin_table.partials = ['index_compact']
      blacklight_config.view.admin_table.document_actions = []
    end

    def show
      authorize! :curate, @exhibit

      @pages = @exhibit.pages.recent.limit(5)
      @solr_documents = load_recent_solr_documents 5

      attach_dashboard_breadcrumbs
    end

    def analytics
      authorize! :curate, @exhibit

      attach_analytics_breadcrumbs
    end

    def _prefixes
      @_prefixes ||= super + ['spotlight/catalog', 'catalog']
    end

    protected

    def attach_analytics_breadcrumbs
      add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
      add_breadcrumb t(:'spotlight.curation.sidebar.analytics'), analytics_exhibit_dashboard_path(@exhibit)
    end

    def attach_dashboard_breadcrumbs
      add_breadcrumb t(:'spotlight.exhibits.breadcrumb', title: @exhibit.title), @exhibit
      add_breadcrumb t(:'spotlight.curation.sidebar.dashboard'), exhibit_dashboard_path(@exhibit)
    end

    def load_recent_solr_documents(count)
      solr_params = { sort: "#{blacklight_config.index.timestamp_field} desc" }
      @response, docs = search_results(solr_params, search_params_logic)
      docs.take(count)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
blacklight-spotlight-0.17.1 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.17.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.16.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.15.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.14.2 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.14.1 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.14.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.13.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.12.1 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.12.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.11.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.10.3 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.10.2 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.10.1 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.10.0 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.9.2 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.9.1 app/controllers/spotlight/dashboards_controller.rb
blacklight-spotlight-0.9.0 app/controllers/spotlight/dashboards_controller.rb