Sha256: fb7174fd43635b930af01ad29e738027185e21ce047c3bed064af5349aeae6d6
Contents?: true
Size: 1.94 KB
Versions: 21
Compression:
Stored size: 1.94 KB
Contents
# frozen_string_literal: true 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::SearchHelper before_action only: [:show] do blacklight_config.action_mapping&.delete(:show) blacklight_config.view.clear blacklight_config.view.admin_table(partials: ['index_compact'], document_actions: []) blacklight_config.track_search_session = false blacklight_config.action_mapping.show.top_level_config = :index if blacklight_config.key?(:action_mapping) end def show authorize! :curate, @exhibit @pages = @exhibit.pages.recent.limit(5) @solr_documents = load_recent_solr_documents 5 @recent_reindexing = @exhibit.job_trackers.where.not(job_class: Spotlight::Engine.config.hidden_job_classes).recent 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_service.search_results do |builder| builder.merge(solr_params) end docs.take(count) end end end
Version data entries
21 entries across 21 versions & 1 rubygems