Sha256: 6acfbf0420b5db34393327748de8eeca43afccf55857b41d249cf902c51b2f47

Contents?: true

Size: 974 Bytes

Versions: 6

Compression:

Stored size: 974 Bytes

Contents

class Admin::TagsController < Admin::BaseController
  
  def list
    index
    render :action => 'index'
  end
  
  def index
    if params[:order] and params[:order] =~ /\A(?:name|display_name|article_counter)\Z/
      if params[:sense] and params[:sense] == 'desc'
        order = params[:order] + " asc"
      else
        order = params[:order] + " desc"
      end
    else
      order = 'display_name ASC'
    end
    
    count = Tag.count
    @tags_pages = Paginator.new(self, count, 20, params[:id])
    @tags = Tag.find_all_with_article_counters(20 , order, @tags_pages.current.offset)

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

    if request.post? and @tag.save
      flash[:notice] = 'Tag was successfully updated.'
      redirect_to :action => 'list'
    end
  end
    
  def destroy
    @tag = Tag.find(params[:id])
    if request.post?
      @tag.destroy
      redirect_to :action => 'list'
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
typo-5.0.3.98.1 app/controllers/admin/tags_controller.rb
typo-5.0.3.98 app/controllers/admin/tags_controller.rb
typo-5.1.2 app/controllers/admin/tags_controller.rb
typo-5.1.1 app/controllers/admin/tags_controller.rb
typo-5.1.3 app/controllers/admin/tags_controller.rb
typo-5.1 app/controllers/admin/tags_controller.rb