Sha256: 2f3ad675898eb84a3d4c8de189af58a3e2f8cb00eb6f5a55f03ef568b37bea1c

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

module QuicCms
  class Admin::PagesController < ApplicationController
    def index
      @pages = Page.all
    end

    def show
      if params[:permalink]
        @page = Page.find_by_permalink(params[:permalink])
        if @page.nil?
          @page = Page.new(:title => "Page with permalink of #{params[:permalink]} does not exist", :content => "If you are an Admin Please <a href='/users/sign_in'> Log in </a>and create it", :permalink => params[:permalink])
        end
      else
        @page = Page.find(params[:id])
      end
    end

    def new
      @page = Page.new
    end

    def create
      @page = Page.new(params[:page])
      if @page.save
        redirect_to [:admin, @page], :notice => "Successfully created page."
      else
        render :action => 'new'
      end
    end

    def edit
      @page = Page.find(params[:id])
    end

    def update
      @page = Page.find(params[:id])
      if @page.update_attributes(params[:page])
        redirect_to [:admin, @page], :notice  => "Successfully updated page."
      else
        render :action => 'edit'
      end
    end

    def destroy
      @page = Page.find(params[:id])
      @page.destroy
      redirect_to admin_pages_url, :notice => "Successfully destroyed page."
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
quic_cms-0.1.4 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.1.3 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.1.2 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.1.1 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.1.0 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.0.9 app/controllers/quic_cms/admin/pages_controller.rb
quic_cms-0.0.8 app/controllers/quic_cms/admin/pages_controller.rb