Sha256: 68fba56f053eefa01703288859e5b85479a09fdf95a7a63b4f155d53c4664be9

Contents?: true

Size: 702 Bytes

Versions: 10

Compression:

Stored size: 702 Bytes

Contents

module Trestle
  module Controller
    module Location
      extend ActiveSupport::Concern

      included do
        after_action :set_trestle_location_header
      end

      # The X-Trestle-Location header is set to indicate that the remote form has triggered
      # a new page URL (e.g. new -> show) without demanding a full page refresh.
      def set_trestle_location_header
        unless dialog_request? || response.location
          headers["X-Trestle-Location"] = request.path
        end
      end

      # Do not use Turbolinks for redirects from a dialog request
      def visit_location_with_turbolinks(location, action)
        super unless dialog_request?
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
trestle-0.9.8 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.7 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.6 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.5 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.4 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.3 app/controllers/concerns/trestle/controller/location.rb
trestle-0.9.2 lib/trestle/controller/location.rb
trestle-0.9.1 lib/trestle/controller/location.rb
trestle-0.9.0 lib/trestle/controller/location.rb
trestle-0.8.13 lib/trestle/controller/location.rb