|
|
@ -1,6 +1,7 @@
|
|
|
|
# This controller was added by william
|
|
|
|
# This controller was added by william
|
|
|
|
class TagsController < ApplicationController
|
|
|
|
class TagsController < ApplicationController
|
|
|
|
layout "base_tags"
|
|
|
|
layout "base_tags"
|
|
|
|
|
|
|
|
|
|
|
|
before_filter :require_admin,:only => :show
|
|
|
|
before_filter :require_admin,:only => :show
|
|
|
|
include ProjectsHelper
|
|
|
|
include ProjectsHelper
|
|
|
|
include IssuesHelper
|
|
|
|
include IssuesHelper
|
|
|
@ -8,11 +9,13 @@ class TagsController < ApplicationController
|
|
|
|
include BidsHelper
|
|
|
|
include BidsHelper
|
|
|
|
include ActsAsTaggableOn::TagsHelper
|
|
|
|
include ActsAsTaggableOn::TagsHelper
|
|
|
|
helper :projects
|
|
|
|
helper :projects
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before_filter :require_admin,:only => [:delete,:show_all]
|
|
|
|
|
|
|
|
|
|
|
|
$selected_tags = Array.new
|
|
|
|
$selected_tags = Array.new
|
|
|
|
$related_tags = Array.new
|
|
|
|
$related_tags = Array.new
|
|
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
def index
|
|
|
|
|
|
|
|
|
|
|
|
$selected_tags = []
|
|
|
|
$selected_tags = []
|
|
|
|
$related_tags = []
|
|
|
|
$related_tags = []
|
|
|
|
$selected_tags << params[:q]
|
|
|
|
$selected_tags << params[:q]
|
|
|
@ -93,9 +96,10 @@ class TagsController < ApplicationController
|
|
|
|
@show_flag = params[:show_flag]
|
|
|
|
@show_flag = params[:show_flag]
|
|
|
|
$selected_tags << @tag
|
|
|
|
$selected_tags << @tag
|
|
|
|
$related_tags.delete(@tag)
|
|
|
|
$related_tags.delete(@tag)
|
|
|
|
|
|
|
|
|
|
|
|
@obj_pages = nil
|
|
|
|
@obj_pages = nil
|
|
|
|
@numbers = Setting.tags_show_search_results
|
|
|
|
@numbers = Setting.tags_show_search_results
|
|
|
|
|
|
|
|
|
|
|
|
# @issues_results = get_issues_by_tag($selected_tags)
|
|
|
|
# @issues_results = get_issues_by_tag($selected_tags)
|
|
|
|
# @projects_results = get_projects_by_tag($selected_tags)
|
|
|
|
# @projects_results = get_projects_by_tag($selected_tags)
|
|
|
|
# @users_results = get_users_by_tag($selected_tags)
|
|
|
|
# @users_results = get_users_by_tag($selected_tags)
|
|
|
@ -151,6 +155,7 @@ class TagsController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
@obj_pages = nil
|
|
|
|
@obj_pages = nil
|
|
|
|
@numbers = Setting.tags_show_search_results
|
|
|
|
@numbers = Setting.tags_show_search_results
|
|
|
|
|
|
|
|
|
|
|
|
# @issues_results = get_issues_by_tag($selected_tags)
|
|
|
|
# @issues_results = get_issues_by_tag($selected_tags)
|
|
|
|
# @projects_results = get_projects_by_tag($selected_tags)
|
|
|
|
# @projects_results = get_projects_by_tag($selected_tags)
|
|
|
|
# @users_results = get_users_by_tag($selected_tags)
|
|
|
|
# @users_results = get_users_by_tag($selected_tags)
|
|
|
@ -201,8 +206,8 @@ class TagsController < ApplicationController
|
|
|
|
def count(name)
|
|
|
|
def count(name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def show
|
|
|
|
def show_all
|
|
|
|
|
|
|
|
@tags = ActsAsTaggableOn::Tag.find(:all)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def for_pagination(results)
|
|
|
|
def for_pagination(results)
|
|
|
@ -212,5 +217,25 @@ class TagsController < ApplicationController
|
|
|
|
@offset ||= @obj_pages.offset
|
|
|
|
@offset ||= @obj_pages.offset
|
|
|
|
results = results.offset(@offset).limit(@limit).order('lft').all
|
|
|
|
results = results.offset(@offset).limit(@limit).order('lft').all
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete
|
|
|
|
|
|
|
|
if params[:q]
|
|
|
|
|
|
|
|
@tag = ActsAsTaggableOn::Tag.find_by_id(params[:q])
|
|
|
|
|
|
|
|
@tag.delete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@taggings = ActsAsTaggableOn::Tagging.find_all_by_tag_id(@tag.id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@taggings.each do |tagging|
|
|
|
|
|
|
|
|
tagging.delete
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tagged_on_object(object)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|