Sha256: 127b5dbdf9f14b9b92f2a8703d1d525dc5f1c76b1d8dfc2e6570d690f5250e9b

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

module Spotlight
  class FeaturePagesController < PagesController

    load_and_authorize_resource through: :exhibit, instance_name: 'page'
    before_filter :attach_breadcrumbs

    protected
    def attach_breadcrumbs
      super

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

      if @page
        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]
      elsif action_name == 'index'
        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
    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

5 entries across 5 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.3.1 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.3.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.2.0 app/controllers/spotlight/feature_pages_controller.rb
blacklight-spotlight-0.1.0 app/controllers/spotlight/feature_pages_controller.rb