Sha256: 6a7b5d71b40f12b2c4924cf1097fd0da822db31dc6fe8bf5e88f3abd8fceb1ed

Contents?: true

Size: 1.14 KB

Versions: 7

Compression:

Stored size: 1.14 KB

Contents

module Spree
  class ContentController < Spree::StoreController
    # Don't serve local files or static assets
    before_action { render_404 if params[:path] =~ /(\.|\\)/ }
    after_action :fire_visited_path, only: :show

    rescue_from ActionView::MissingTemplate, with: :render_404

    respond_to :html

    def show
      ActiveSupport::Deprecation.warn(<<-EOS, caller)
        ContentController#show is deprecated and will be removed in Spree 3.5
        Please don't use dynamic render paths and just declare your actions in
        ContentController decorator, eg.

        routes.rb:
        get '/content/custom_page', to: 'content#custom_page', as: :custom_page

        controllers/spree/content_controller_decorator.rb:
        Spree::ContentController.class_eval do
          def custom_page
          end
        end

        change links from:
        spree.content_path('custom_page')

        to:
        spree.custom_page
      EOS
      render action: params[:path]
    end

    def cvv
      render layout: false
    end

    def fire_visited_path
      Spree::PromotionHandler::Page.new(current_order, params[:path]).activate
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
spree_frontend-3.4.6 app/controllers/spree/content_controller.rb
spree_frontend-3.4.5 app/controllers/spree/content_controller.rb
spree_frontend-3.4.4 app/controllers/spree/content_controller.rb
spree_frontend-3.4.3 app/controllers/spree/content_controller.rb
spree_frontend-3.4.2 app/controllers/spree/content_controller.rb
spree_frontend-3.4.1 app/controllers/spree/content_controller.rb
spree_frontend-3.4.0 app/controllers/spree/content_controller.rb