Sha256: 1fe6e6d5504a8f635881eb08d758cd2f2562891a1a7d762b41ac55fd006c0791

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

# frozen_string_literal: true
Thredded::Engine.routes.draw do
  resource :theme_preview, only: [:show], path: 'theme-preview' if %w(development test).include? Rails.env

  page_constraint = { page: /[1-9]\d*/ }

  scope path: 'private-topics' do
    resource :private_topic, only: [:new], path: ''
    resources :private_topics, except: [:new, :show], path: '' do
      member do
        get '(page-:page)', action: :show, as: '', constraints: page_constraint
      end
      resources :private_posts, path: '', except: [:index, :show], controller: 'posts'
    end
  end

  resources :autocomplete_users, only: [:index], path: 'autocomplete-users'

  constraints(->(req) { req.env['QUERY_STRING'].include? 'q=' }) do
    get '/' => 'topics#search', as: :messageboards_search
    get '/:messageboard_id(.:format)' => 'topics#search', as: :messageboard_search
  end

  resource :preferences, only: [:edit, :update]
  resource :messageboard, path: 'messageboards', only: [:new]
  resources :messageboards, only: [:index, :create], path: '' do
    resource :preferences, only: [:edit, :update]
    resource :topic, path: 'topics', only: [:new]
    resources :topics, path: '', except: [:index, :new, :show] do
      collection do
        get '(page-:page)', action: :index, as: '', constraints: page_constraint
        get '/category/:category_id', action: :category, as: :categories
      end
      member do
        get '(page-:page)', action: :show, as: '', constraints: page_constraint
      end
      resources :posts, except: [:index, :show], path: ''
    end
  end

  root to: 'messageboards#index'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
thredded-0.3.2 config/routes.rb
thredded-0.3.1 config/routes.rb
thredded-0.3.0 config/routes.rb