# -*- encoding : utf-8 -*-

class Admin::TagsController < ApplicationController
  layout "admin"
  before_filter :auth_admin

  def index
    @tags = Tag.all

  end
  

  def show
    @tag = Tag.find(params[:id])

  end

  def new
    
    
		@tag = Tag.new
    
  

  end

 

  def edit
    
    
    @tag = Tag.find(params[:id])
  end

  def create
    @tag = Tag.new(params.require(:tag).permit!)


    if @tag.save
      @tags = Tag.all
      
    else
      render action: "new"
 
    end

  end


  def update
    @tag = Tag.find(params[:id])


    if @tag.update_attributes(params.require(:tag).permit!)
      @tags = Tag.all
     
    else
     render action: "edit" 
      
    end
      
  end


  def destroy
    @tag = Tag.find(params[:id])
    @tag.destroy
    @tags = Tag.all
  

  end
end
