Sha256: 3d8ddf35e990fdd6c6bbcaca18f751bf2b6d7300ed748d0c0d46ed584bc280b9

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 Bytes

Contents

class Spree::StaticContentController < Spree::BaseController
  caches_action :show
  layout :determine_layout
  
  def show
    path = case params[:path]
    when Array
      '/' + params[:path].join("/")
    when String
      '/' + params[:path]
    when nil
      request.path
    end

    unless @page = Spree::Page.visible.find_by_slug(path.gsub('//','/'))
      render_404
    end
  end

  private
  
  def determine_layout
    return @page.layout if @page and @page.layout.present?
    'spree/layouts/spree_application'
  end

  def accurate_title
    @page ? (@page.meta_title ? @page.meta_title : @page.title) : nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_static_content-1.0.1 app/controllers/spree/static_content_controller.rb