Sha256: 6b18c34b6e391602cdc6ce02fbabd9d5695f3a0f0e71b62a109d8759a4e07726

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

class IllustrationsController < ApplicationController
  
  before_filter :authenticate
  before_filter :authenticate_with_admin
  
  def index
    @illustrations = Illustration.by_recent.paginate(:page => params[:page], :per_page => 25)
    switch_to_admin_layout
  end
  
  def show
    @illustration = Illustration.find(params[:id])
    switch_to_admin_layout
  end
  
  def new
    @illustration = Illustration.new
    switch_to_admin_layout
  end
  
  def edit
    @illustration = Illustration.find(params[:id])
    switch_to_admin_layout
  end
  
  def create
    @illustration = Illustration.new(params[:illustration])
    if @illustration.save
      redirect_to @illustration, notice: 'Illustration was successfully created.'
    else
      render action: "new", layout: 'admin'
    end
  end
  
  def update
    @illustration = Illustration.find(params[:id])
    if @illustration.update_attributes(params[:illustration])
      redirect_to @illustration, notice: 'Illustration was successfully updated.'
    else
      render action: "edit", layout: 'admin'
    end
  end
  
  def destroy
    @illustration = Illustration.find(params[:id])
    @illustration.destroy
    redirect_to illustrations_url
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tkh_illustrations-0.1 app/controllers/illustrations_controller.rb
tkh_illustrations-0.0.10 app/controllers/illustrations_controller.rb