Sha256: ae45adbcd0ad9fc00c245d6a45e3e0b23d04ebcea619026789c656c4b1d1bee9

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

class Manager::TagsController < Manager::ManagerController

  before_filter :set_lists

  def index
    @tags = Tag.unscoped
    authorize! :index, Tag.new
  end
  
  def show
    @tag = Tag.unscoped.find params[:id]
    authorize! :show, @tag
  end

  def new
    @tag = Tag.new
    authorize! :new, @tag
  end

  def create
    @tag = Tag.create params[:tag].permit( :name, :name_seo, :descr, :is_public, :is_feature, :is_trash,
                                           :weight, :parent_tag_id, :site_id )
    authorize! :create, @tag
    if @tag.save
      flash[:notice] = 'Success.'
      redirect_to manager_tags_path
    else
      puts! @tag.errors, "error creating tag."
      flash[:error] = "No luck. #{@tag.errors.messages}" 
      render :action => :new
    end
  end

  def edit
    @tag = Tag.unscoped.find params[:id]
    authorize! :edit, @tag
  end

  def update
    @tag = Tag.unscoped.find params[:id]
    authorize! :update, @tag
    if @tag.update_attributes params[:tag].permit( :name, :name_seo, :descr,
                                                   :is_public, :is_trash, :is_feature, :weight,
                                                   :site_id, :parent_tag_id )
      flash[:notice] = 'Success.'
      redirect_to manager_tags_path
    else
      flash[:error] = 'No luck.'
      render :action => :new
    end
  end
  
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ish_manager-0.1.2 app/controllers/ish_manager/tags_controller.rb
ish_manager-0.1.0 app/controllers/ish_manager/tags_controller.rb
ish_lib_engine-0.0.1 app/controllers/ish_lib_engine/manager/tags_controller.rb~