Sha256: 285fb1a923f466cde30e15efd141a5e22cee5d50edfd631623c62c20c1234964

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

class IllustrationsController < ApplicationController
  
  before_filter :authenticate
  before_filter :authenticate_with_admin
  
  def index
    @illustrations = Illustration.by_recent
    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

5 entries across 5 versions & 1 rubygems

Version Path
tkh_illustrations-0.0.9 app/controllers/illustrations_controller.rb
tkh_illustrations-0.0.8 app/controllers/illustrations_controller.rb
tkh_illustrations-0.0.7 app/controllers/illustrations_controller.rb
tkh_illustrations-0.0.6 app/controllers/illustrations_controller.rb
tkh_illustrations-0.0.5 app/controllers/illustrations_controller.rb