Sha256: 51dc61e5ea182544440f04d47ea29a4916697cbd06d3aa195fab264e33dcde99

Contents?: true

Size: 706 Bytes

Versions: 4

Compression:

Stored size: 706 Bytes

Contents

module TypeStation
  class PagesController < TypeStation::ApplicationController
    layout 'application'
    
    def index
      @page = present Page.root
      render_type_station
    end

    def show
      @page = present Page.find_by_path(params[:path])
      render_type_station
    end

    private

    def render_type_station
      if @page.present?
        if @page.redirect?
          redirect_to @page.redirect_to
        else
          if @page.template_name? 
            render "pages/#{@page.template_name}"
          else
            raise TypeStation::PageTemplateNameUndefined
          end
        end
      else
        raise TypeStation::PageNotFoundError
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
type_station-0.0.3 app/controllers/type_station/pages_controller.rb
type_station-0.0.2 app/controllers/type_station/pages_controller.rb
type_station-0.0.1 app/controllers/type_station/pages_controller.rb
type_station-0.0.1.pre app/controllers/type_station/pages_controller.rb