Sha256: 48636918c912342125cf5b8db2603e9d2aafe6f869fa4f47e675267d7c640dcf

Contents?: true

Size: 1.49 KB

Versions: 50

Compression:

Stored size: 1.49 KB

Contents

# frozen_string_literal: true

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

    # We're oddly getting an unknown action
    # error w/o explicitly defining this here
    def clone
      super
    end

    protected

    def attach_breadcrumbs
      super

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

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

      add_breadcrumb @page.parent_page.title, [spotlight, @page.exhibit, @page.parent_page] unless @page.top_level_page?
      add_breadcrumb @page.title, action_name == 'edit' ? [:edit, @page.exhibit, @page] : [spotlight, @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' => %i[id title display_title]
      )
    end

    def allowed_page_params
      super.concat %i[display_sidebar published]
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
blacklight-spotlight-4.1.2 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.1.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.1.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.0.3 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.0.2 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.0.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-4.0.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta10 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta9 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta8 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.5.0.4 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta7 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.5.0.3 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta6 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta5 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta4 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta3 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.6.0.beta1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.5.0.2 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-3.5.0.1 app/controllers/spotlight/feature_pages_controller.rb