Sha256: 1cfc6a0bc4c9a37b45071c14d9b310ad2b01391db4b7acead55bc703772c4623

Contents?: true

Size: 1.21 KB

Versions: 22

Compression:

Stored size: 1.21 KB

Contents

module Locomotive
  module Public
    class PagesController < ApplicationController

      include Locomotive::Routing::SiteDispatcher
      include Locomotive::Render
      include Locomotive::ActionController::LocaleHelpers

      before_filter :require_site

      before_filter :authenticate_locomotive_account!, only: [:show_toolbar]

      before_filter :validate_site_membership, only: [:show_toolbar]

      before_filter :set_toolbar_locale, only: :show_toolbar

      before_filter :set_locale, only: [:show, :edit]

      helper Locomotive::BaseHelper

      def show_toolbar
        render layout: false
      end

      def show
        render_locomotive_page
      end

      def edit
        @editing = true
        render_locomotive_page
      end

      protected

      def set_toolbar_locale
        ::I18n.locale = current_locomotive_account.locale rescue Locomotive.config.default_locale
        ::Mongoid::Fields::I18n.locale = params[:locale] || current_site.default_locale
      end

      def set_locale
        ::Mongoid::Fields::I18n.locale = params[:locale] || current_site.default_locale
        ::I18n.locale = ::Mongoid::Fields::I18n.locale

        self.setup_i18n_fallbacks
      end

    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
locomotive_cms-2.5.5 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.4 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.3 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.2 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.1 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.0 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.0.rc3 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.0.rc2 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.5.0.rc1 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.4.1 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.4.0 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.3.1 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.3.0 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.2.3 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.2.2 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.2.1 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.2.0 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.1.4 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.1.3 app/controllers/locomotive/public/pages_controller.rb
locomotive_cms-2.1.2 app/controllers/locomotive/public/pages_controller.rb