Sha256: 93d13ede98287c1e487e06a5ffdcd2036e503ef4d7654ddd25656373c1f34274

Contents?: true

Size: 1.34 KB

Versions: 25

Compression:

Stored size: 1.34 KB

Contents

module Scrivito
  #
  # The helper contains methods to generate URLs to CMS content.
  # Use {Scrivito::RoutingHelper#scrivito_path} or {Scrivito::RoutingHelper#scrivito_url} when linking or
  # redirecting to CMS objects. These methods are available in boths your views and your controllers.
  #
  # @api public
  #
  module RoutingHelper
    #
    # Returns the (URL-)path for a cms object.
    #
    # @api public
    #
    # @param target [Obj, Link, Array<Link>, Binary]
    #   If +target+ is an +Array+ of +Links+, it must be non-empty.
    #   The first {Link} from the +Array+ will be used.
    # @param options [Hash] include url settings such as path parameters or protocol.
    #
    # @return [String]
    #
    def scrivito_path(target, options = {})
      CmsRouting.new(request, main_app).path_or_url(target, "path", options)
    end

    #
    # Returns the absolute URL for a cms object.
    #
    # @api public
    #
    # @param target [Obj, Link, Array<Link>, Binary]
    #   If +target+ is an +Array+ of +Links+, it must be non-empty.
    #   The first {Link} from the +Array+ will be used.
    # @param options [Hash] include url settings such as path parameters or protocol.
    #
    # @return [String]
    #
    def scrivito_url(target, options = {})
      CmsRouting.new(request, main_app).path_or_url(target, "url", options)
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
scrivito_sdk-0.41.0.rc1 lib/scrivito/routing_helper.rb
scrivito_sdk-0.40.0 lib/scrivito/routing_helper.rb
scrivito_sdk-0.40.0.rc2 lib/scrivito/routing_helper.rb
scrivito_sdk-0.40.0.rc1 lib/scrivito/routing_helper.rb
scrivito_sdk-0.30.0 lib/scrivito/routing_helper.rb