class Admin::ItemsController < Admin::ApplicationController

  def index
    @items = Item.find(:all)
  end

  def new
    @item = Item.new
  end

  def show
    @item = Item.find(params[:id])
  end

  def create
    @item = Item.new(params[:item])
    if @item.save
      flash[:notice] = 'Item was successfully created.'
      redirect_to :controller => 'items', :action => 'show', :id => @item, :new => 'true'
    else
      render :action => 'new'
    end
  end

  def edit
    @item = Item.find(params[:id])
  end

  def update
    @item = Item.find(params[:id])
    @item.update_attributes(params[:item])
    redirect_to admin_item_path(@item)
  end

  def destroy
    Item.find(params[:id]).destroy
    render :nothing => true
  end
end