Sha256: 55fc6df6e37fd100e4a984bfca4df5d4f48a1256fdb2c53c8e6a6469e0ff69ab

Contents?: true

Size: 1.41 KB

Versions: 25

Compression:

Stored size: 1.41 KB

Contents

module Kuhsaft
  module Cms
    class PagesController < AdminController
      def index
        @pages = Kuhsaft::Page.roots
        respond_with @pages
      end

      def show
        @page = Kuhsaft::Page.find(params[:id])
        respond_with @page
      end

      def new
        @page = Kuhsaft::Page.new
        @page.published ||= Kuhsaft::PublishState::UNPUBLISHED
        respond_with @page
      end

      def create
        @page = Kuhsaft::Page.create params[:page]

        if @page.valid?
          flash[:success] = t('layouts.kuhsaft.cms.flash.success', :subject => Kuhsaft::Page.model_name.human)
          respond_with @page, :location => kuhsaft.edit_cms_page_path(@page)
        else
          render 'new'
        end
      end

      def edit
        @page = Kuhsaft::Page.find(params[:id])
        @page.published ||= Kuhsaft::PublishState::UNPUBLISHED
        respond_with @page
      end

      def update
        @page = Kuhsaft::Page.find(params[:id])
        if @page.update_attributes(params[:page])
          flash[:success] = t('layouts.kuhsaft.cms.flash.success', :subject => Kuhsaft::Page.model_name.human)
          respond_with @page, :location => kuhsaft.edit_cms_page_path(@page)
        else
          render 'edit'
        end
      end

      def destroy
        @page = Kuhsaft::Page.find(params[:id])
        @page.destroy
        redirect_to kuhsaft.cms_pages_path
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
kuhsaft-1.7.1 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.7.0 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.6.0 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.5.0 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.4.3 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.4.2 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.4.1 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.4.0 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.3.1 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.15 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.14 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.13 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.12 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.11 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.10 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.9 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.8 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.7 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.6 app/controllers/kuhsaft/cms/pages_controller.rb
kuhsaft-1.2.5 app/controllers/kuhsaft/cms/pages_controller.rb