Sha256: d7b352304e3aed3fd4537c68353f9bebb6be0d2239ce08fc53c5e8df37e8556a

Contents?: true

Size: 1.03 KB

Versions: 11

Compression:

Stored size: 1.03 KB

Contents

class HeadersController < ApplicationController
  
  before_filter :authenticate
  before_filter :authenticate_with_admin
  
  def index
    @headers = Header.by_recent.paginate(:page => params[:page], :per_page => 25)
    switch_to_admin_layout
  end
  
  def show
    @header = Header.find(params[:id])
    switch_to_admin_layout
  end
  
  def new
    @header = Header.new
    switch_to_admin_layout
  end
  
  def edit
    @header = Header.find(params[:id])
    switch_to_admin_layout
  end
  
  def create
    @header = Header.new(params[:header])
    if @header.save
      redirect_to @header, notice: t('headers.create.notice')
    else
      render action: "new", layout: 'admin'
    end
  end
  
  def update
    @header = Header.find(params[:id])
    if @header.update_attributes(params[:header])
      redirect_to @header, notice: t('headers.update.notice')
    else
      render action: "edit", layout: 'admin'
    end
  end
  
  def destroy
    @header = Header.find(params[:id])
    @header.destroy
    redirect_to headers_url
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tkh_illustrations-0.9.6 app/controllers/headers_controller.rb
tkh_illustrations-0.9.5 app/controllers/headers_controller.rb
tkh_illustrations-0.9.4 app/controllers/headers_controller.rb
tkh_illustrations-0.9.3 app/controllers/headers_controller.rb
tkh_illustrations-0.9.2 app/controllers/headers_controller.rb
tkh_illustrations-0.9.1 app/controllers/headers_controller.rb
tkh_illustrations-0.2.5 app/controllers/headers_controller.rb
tkh_illustrations-0.9 app/controllers/headers_controller.rb
tkh_illustrations-0.2.4 app/controllers/headers_controller.rb
tkh_illustrations-0.2.3 app/controllers/headers_controller.rb
tkh_illustrations-0.2 app/controllers/headers_controller.rb