Sha256: faa11838a1efccb6a599d4dcf31fa2bedecb815632f1fe1597b3f0cf86e974c8

Contents?: true

Size: 847 Bytes

Versions: 9

Compression:

Stored size: 847 Bytes

Contents

# Controls CRUD actions for {Page}. Only accessible by admin {Editor}s.
class Manifest::PagesController < Manifest::ManifestController
  before_filter :authorize_admin, except: [:index, :show]

  layout :set_layout

  def index
    @pages = Page.all
  end

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

  def new
    @page = Page.new
  end

  def create
    @page = Page.new(params[:page])

    if @page.save
      redirect_to manifest_page_path(@page)
    else
      render '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 manifest_pages_path
    else
      render 'edit'
    end
  end

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

    redirect_to manifest_pages_path
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
manifest-rails-0.2.8 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.7 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.6 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.5 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.4 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.3 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.2 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.1 app/controllers/manifest/pages_controller.rb
manifest-rails-0.2.0 app/controllers/manifest/pages_controller.rb