Sha256: 97b9705e12b09cc367b9eaf2cc910497aee5c8c3f06cb89c537e1a948c24f6f9

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 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: 'Header was successfully created.'
    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: 'Header was successfully updated.'
    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

1 entries across 1 versions & 1 rubygems

Version Path
tkh_illustrations-0.1 app/controllers/headers_controller.rb