class Panel::Announcement::BackEnd::BulletinCategorysController < ApplicationController
  
  layout 'admin'
  
  def index
    @bulletin_categorys = BulletinCategory.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @bulletins }
    end
  end

  # GET /bulletins/1
  # GET /bulletins/1.xml
  def show
    @bulletin_category = BulletinCategory.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @bulletin_category }
    end
  end

  # GET /bulletins/new
  # GET /bulletins/new.xml
  def new
    @bulletin_category = BulletinCategory.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @bulletin_category }
    end
  end

  # GET /bulletins/1/edit
  def edit
    @bulletin_category = BulletinCategory.find(params[:id])
    @i18n_variable = @bulletin_category.i18n_variable
  end

  # POST /bulletins
  # POST /bulletins.xml
  def create
    @bulletin_category = BulletinCategory.new(params[:bulletin_category])

    respond_to do |format|
      if @bulletin_category.save
        # format.html { redirect_to(panel_announcement_back_end_bulletin_url(@bulletin_category), :notice => t('announcement.create_bulletin_success')) }
        format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('announcement.create_bulletin_category_success')) }
        format.xml  { render :xml => @bulletin_category, :status => :created, :location => @bulletin_category }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /bulletins/1
  # PUT /bulletins/1.xml
  def update
    @bulletin_category = BulletinCategory.find(params[:id])

    respond_to do |format|
      if @bulletin_category.update_attributes(params[:bulletin_category])
        # format.html { redirect_to(panel_announcement_back_end_bulletin_category_url(@bulletin_category), :notice => t('bulletin_category.update_bulletin_category_success')) }
        format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url, :notice => t('bulletin_category.update_bulletin_category_success')) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @bulletin_category.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /bulletins/1
  # DELETE /bulletins/1.xml
  def destroy
    @bulletin_category = BulletinCategory.find(params[:id])
    @bulletin_category.destroy

    respond_to do |format|
      format.html { redirect_to(panel_announcement_back_end_bulletin_categorys_url) }
      format.xml  { head :ok }
    end
  end
end
