21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/boar/router.rb', line 21
def self.mount_pages(router, *args)
options = args.
config = Rails.application.config.boar
root = get_option(options, :root, config.pages_root)
root += "/" if root.present? && root !~ /\/$/
locale_param = get_option(options, :locale_param, config.locale_param).to_sym
default_locale = get_option(options, :default_locale, config.default_locale).to_sym
locale_regexp = get_option(options, :locale_regexp, config.locale_regexp)
route_options = get_option(options, :route_options, {}).deep_symbolize_keys
router.scope(module: :boar) do
router.scope("(#{locale_param.inspect})", defaults: {locale_param => default_locale}, constraints: {locale_param => locale_regexp}) do
yield(router, options) if block_given?
router.match("#{root}(*path)", route_controller(options, "pages#main").merge({via: :get, boar_options: options}).merge(route_options))
end
end
end
|