Sha256: f89b7dd458918e0529c3abce448ed05dabe8c137e9cbbc0b324e412b448a43ac

Contents?: true

Size: 1.18 KB

Versions: 8

Compression:

Stored size: 1.18 KB

Contents

module ActionDispatch::Routing
  class Mapper

    def enjoy_cms_routes(config = {})
      routes_config = {
        use_contacts_path: true,
        use_search_path: true,
        use_news_path: true,
        root_path: "home#index",
        use_slug_path: true,
        use_pages_path: true
      }
      routes_config.merge!(config)

      scope module: 'enjoy' do
        if routes_config[:use_contacts_path]
          get 'contacts' => 'contacts#new', as: :enjoy_contacts
          post 'contacts' => 'contacts#create', as: :create_enjoy_contacts
          get 'contacts/sent' => 'contacts#sent', as: :enjoy_contacts_sent
        end

        if routes_config[:use_search_path]
          get 'search' => 'search#index', as: :enjoy_search
        end

        if routes_config[:use_news_path]
          resources :news, only: [:index, :show], as: :enjoy_news
        end

        if routes_config[:root_path]
          root to: routes_config[:root_path]
        end

        if routes_config[:use_slug_path]
          get '*slug' => 'pages#show'
        end
        if routes_config[:use_pages_path]
          resources :pages, only: [:show], as: :enjoy_pages
        end
      end

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
enjoy_cms-0.3.7.4 lib/enjoy/routes.rb
enjoy_cms-0.3.7.3 lib/enjoy/routes.rb
enjoy_cms-0.3.7.2 lib/enjoy/routes.rb
enjoy_cms-0.3.7.1 lib/enjoy/routes.rb
enjoy_cms-0.3.7 lib/enjoy/routes.rb
enjoy_cms-0.3.6.2 lib/enjoy/routes.rb
enjoy_cms-0.3.6.1 lib/enjoy/routes.rb
enjoy_cms-0.3.6 lib/enjoy/routes.rb