Sha256: 2214c321ed56872f791acb57cbb912786f5c0ab9ba7794f8919637fe915d2463

Contents?: true

Size: 738 Bytes

Versions: 4

Compression:

Stored size: 738 Bytes

Contents

module Trestle
  class Resource
    module Controller
      module Redirection
      protected
        def redirect_to_return_location(action, instance, status: :found, default: nil, &block)
          fallback_location = block_given? ? block : default

          if admin.return_locations[action] && !modal_request?
            location = instance_exec(instance, &admin.return_locations[action])

            case location
            when :back
              redirect_back fallback_location: fallback_location, status: status
            else
              redirect_to location, status: status
            end
          else
            redirect_to fallback_location, status: status
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.10.1 app/controllers/concerns/trestle/resource/controller/redirection.rb
trestle-0.10.0 app/controllers/concerns/trestle/resource/controller/redirection.rb
trestle-0.10.0.pre2 app/controllers/concerns/trestle/resource/controller/redirection.rb
trestle-0.10.0.pre app/controllers/concerns/trestle/resource/controller/redirection.rb