Sha256: 6e4597e4357f13183a4c55cd559da80171b53ea7b191be994014c809c681f49c

Contents?: true

Size: 731 Bytes

Versions: 23

Compression:

Stored size: 731 Bytes

Contents

module TypeStation
  class PagesController < TypeStation::ApplicationController
    layout 'application'

    def index
      @page = Page.root
      render_type_station
    end

    def show
      @page = 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

23 entries across 23 versions & 1 rubygems

Version Path
type_station-0.7.0 app/controllers/type_station/pages_controller.rb
type_station-0.6.0 app/controllers/type_station/pages_controller.rb
type_station-0.5.4 app/controllers/type_station/pages_controller.rb
type_station-0.5.3 app/controllers/type_station/pages_controller.rb
type_station-0.5.2 app/controllers/type_station/pages_controller.rb
type_station-0.5.1 app/controllers/type_station/pages_controller.rb
type_station-0.4.7 app/controllers/type_station/pages_controller.rb
type_station-0.4.6 app/controllers/type_station/pages_controller.rb
type_station-0.4.5 app/controllers/type_station/pages_controller.rb
type_station-0.4.4 app/controllers/type_station/pages_controller.rb
type_station-0.4.3 app/controllers/type_station/pages_controller.rb
type_station-0.4.2 app/controllers/type_station/pages_controller.rb
type_station-0.4.1 app/controllers/type_station/pages_controller.rb
type_station-0.4.0 app/controllers/type_station/pages_controller.rb
type_station-0.3.4 app/controllers/type_station/pages_controller.rb
type_station-0.3.3 app/controllers/type_station/pages_controller.rb
type_station-0.3.2 app/controllers/type_station/pages_controller.rb
type_station-0.3.1 app/controllers/type_station/pages_controller.rb
type_station-0.3.0 app/controllers/type_station/pages_controller.rb
type_station-0.2.3 app/controllers/type_station/pages_controller.rb