Sha256: 1a52c37549e20c9d8f2cab9dfe89752ec7a04757be3408781662c61000d0bbb7

Contents?: true

Size: 656 Bytes

Versions: 42

Compression:

Stored size: 656 Bytes

Contents

module Locomotive
  module Concerns
    module StoreLocationController

      extend ActiveSupport::Concern

      included do
        helper_method :last_saved_location
      end

      private

      def store_location
        if request.get? && params[:_location].blank?
          session[:return_to] = request.fullpath
        end
      end

      def last_saved_location(default)
        session[:return_to] || default
      end

      def last_saved_location!(default)
        session.delete(:return_to) || default
      end

      def redirect_back_or_default(default)
        redirect_to(last_saved_location!(default))
      end

    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
locomotivecms-4.2.0.alpha2 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.2.0.alpha1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.1.1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.1.0 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.1.0.rc1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.3 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.2 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.0 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.0.rc0 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.0.alpha3 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.4.1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.0.alpha2 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-4.0.0.alpha1 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.4.0 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.3.0 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.3.0.rc3 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.3.0.rc2 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.1.2 app/controllers/locomotive/concerns/store_location_controller.rb
locomotivecms-3.2.1 app/controllers/locomotive/concerns/store_location_controller.rb