module Voom::Presenters::Helpers::Rails

Public Instance Methods

default_url_options() click to toggle source
# File lib/voom/presenters/helpers/rails.rb, line 11
def default_url_options
  {}
end
presenter_path(presenter, host: false, **params)
Alias for: presenters_path
presenter_url(presenter, host: true, **params)
Alias for: presenters_url
presenters_path(presenter, host: false, **params) click to toggle source
# File lib/voom/presenters/helpers/rails.rb, line 15
def presenters_path(presenter, host: false, **params)
  presenter = _expand_namespace_(presenter, namespace)
  presenter = presenter.gsub(':', '/')

  path = host ? voom_presenters_web_client_app_url(params, host: router.base_url) :
                voom_presenters_web_client_app_path(params)

  if path.include?('?')
    path = path.sub('?', "#{presenter}?")
  else
    path = "#{path}/" unless path.end_with?('/')
    # replace last / with the presenter
    path = path.reverse.sub('/', "/#{presenter}".reverse).reverse
  end
  path
end
Also aliased as: presenter_path
presenters_url(presenter, host: true, **params) click to toggle source
# File lib/voom/presenters/helpers/rails.rb, line 34
def presenters_url(presenter, host: true, **params)
  presenters_path(presenter, host: host, **params)
end
Also aliased as: presenter_url