Sha256: d9d073568d89dfca8d7ed10431a0c5096a9dd4bc412eab64422cec3a14bbb310

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 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: /.*/}, as: :book_page
  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.1 config/routes.rb