Sha256: 3c03dc7895d7bb5bf27cbdf65785d53a3a0daa24500151d3c244bd96bb6d141f

Contents?: true

Size: 1.33 KB

Versions: 66

Compression:

Stored size: 1.33 KB

Contents

module Spotlight
  ##
  # CRUD actions for feature pages
  class FeaturePagesController < PagesController
    load_and_authorize_resource through: :exhibit, instance_name: 'page'
    before_action :attach_breadcrumbs

    protected

    def attach_breadcrumbs
      super

      if @page
        attach_page_breadcrumbs
      elsif action_name == 'index'
        attach_index_breadcrumbs
      end
    end

    def attach_page_breadcrumbs
      if action_name == 'edit'
        add_breadcrumb t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)
      end

      add_breadcrumb @page.parent_page.title, [@page.exhibit, @page.parent_page] unless @page.top_level_page?
      add_breadcrumb @page.title, action_name == 'edit' ? [:edit, @page.exhibit, @page] : [@page.exhibit, @page]
    end

    def attach_index_breadcrumbs
      add_breadcrumb t(:'spotlight.curation.sidebar.header'), exhibit_dashboard_path(@exhibit)
      add_breadcrumb t(:'spotlight.curation.sidebar.feature_pages'), exhibit_feature_pages_path(@exhibit)
    end

    def update_all_page_params
      params.require(:exhibit).permit(
        'feature_pages_attributes' => page_attributes,
        'home_page_attributes' => [:id, :title, :display_title]
      )
    end

    def allowed_page_params
      super.concat [:display_sidebar, :published]
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
blacklight-spotlight-1.5.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.4.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.4.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.3.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.2.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.1.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.0.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.0.0.alpha2 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-1.0.0.alpha1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.34.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.34.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.33.3 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.33.2 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.33.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.33.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.32.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.31.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.30.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.29.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.29.0 app/controllers/spotlight/feature_pages_controller.rb