Sha256: ed2778e7911996ad2914173d13c42abeac31eb73b7dd20b73a3a1a9d84a375ae

Contents?: true

Size: 751 Bytes

Versions: 2

Compression:

Stored size: 751 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? && @page.visible?(type_station_current_user)
        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

2 entries across 2 versions & 1 rubygems

Version Path
type_station-0.1.3 app/controllers/type_station/pages_controller.rb
type_station-0.1.1 app/controllers/type_station/pages_controller.rb