Sha256: 9f437bdd39978ad60df5eddff28796a1c40b189a8764d81c05097be1a896d981

Contents?: true

Size: 1.84 KB

Versions: 21

Compression:

Stored size: 1.84 KB

Contents

require "scrivito/preset_routes"

module Scrivito
  module PresetRoutes
    mattr_accessor :delayed
    self.delayed ||= {}

    def self.install_delayed(route_set=nil)
      delayed.each do |route, delayed_lambda|
        delayed_lambda.call(route_set)
      end
    end

    def self.install_into(route_set, do_the_install=false)
      return unless do_the_install
      return if Scrivito::Configuration.scrivito_route_enabled?

      Scrivito::Configuration.with_scrivito_route_enabled do
        route_set.draw do
          scrivito_route '/', using: "homepage", via: :all

          if Scrivito::Configuration.legacy_routing
            scrivito_route ':id(/*slug)', using: "slug_id", via: :all
          else
            scrivito_route '(/)(*slug-):id', using: "slug_id", via: :all

            match ':id(/*slug)', to: 'scrivito/legacy_redirect#index', via: :all, constraints: {
              id: /[0-9]{4,}/
            }
          end

          scrivito_route '/*permalink', using: "permalink", format: false, via: :all
        end
      end
    end

    def self.install_slave_into(route_set, do_the_install=false)
      return unless do_the_install
      return if Scrivito::Configuration.scrivito_route_enabled?

      Scrivito::Configuration.with_scrivito_route_enabled do
        route_set.draw do
          scrivito_route '/f7(/)', using: "homepage", via: :all

          if Scrivito::Configuration.legacy_routing
            scrivito_route '/f7/:id(/*slug)', using: "slug_id", via: :all
          else
            scrivito_route '/f7/(*slug-):id', using: "slug_id", via: :all

            match '/f7/:id(/*slug)', to: 'scrivito/legacy_redirect#index', via: :all, constraints: {
              id: /[0-9]{4,}/
            }
          end

          scrivito_route '/f7/*permalink', using: "permalink", format: false, via: :all
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.5 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.6.1.1.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.6.1.1.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.2.3 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.2.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.2.2 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.5.5.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.5.5.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.1.4 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.5.4.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.5.4.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.1.3 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.5.3.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.4.3.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.3.2.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.2.1.0.pre.beta1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.5.2.0.0 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.1.1 lib/fiona7/scrivito_patches/preset_routes.rb
infopark_fiona7-1.2.0.0.1 lib/fiona7/scrivito_patches/preset_routes.rb