Sha256: 55253fcadfc7bf171a348f9dcaaa65ee4f8a8d08c8e4d3f31ae5a1c9719527ed

Contents?: true

Size: 649 Bytes

Versions: 1

Compression:

Stored size: 649 Bytes

Contents

# frozen_string_literal: true

Scrapbook::Engine.routes.draw do
  book_regex = /#{Scrapbook::Engine.config.scrapbook.paths.map { File.basename(_1) }.join('|')}/

  resources :pages, id: /.+/
  resources :pages, path: ':book/pages', id: /.+/, constraints: {book: book_regex}

  get ':book', to: 'pages#index', constraints: {book: book_regex}
  root 'pages#index'

  get '.raw/:book/pages/*id', to: 'pages#raw', as: :raw_page,
    constraints: {book: book_regex, id: /.*/}, defaults: {raw: true}
  get ':book/*id', to: 'pages#show', constraints: {book: book_regex, id: /.*/}
  get '*id', to: 'pages#show', constraints: {id: /.*/}, as: :short_page
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scrapbook-0.2.0 config/routes.rb