diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index a0f0fb046..a7c787746 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -1,6 +1,7 @@ # This controller was added by william class TagsController < ApplicationController layout "base_tags" + before_filter :require_admin,:only => :show include ProjectsHelper include IssuesHelper @@ -8,11 +9,13 @@ class TagsController < ApplicationController include BidsHelper include ActsAsTaggableOn::TagsHelper helper :projects + + before_filter :require_admin,:only => [:delete,:show_all] $selected_tags = Array.new $related_tags = Array.new + def index - $selected_tags = [] $related_tags = [] $selected_tags << params[:q] @@ -93,9 +96,10 @@ class TagsController < ApplicationController @show_flag = params[:show_flag] $selected_tags << @tag $related_tags.delete(@tag) - + @obj_pages = nil @numbers = Setting.tags_show_search_results + # @issues_results = get_issues_by_tag($selected_tags) # @projects_results = get_projects_by_tag($selected_tags) # @users_results = get_users_by_tag($selected_tags) @@ -151,6 +155,7 @@ class TagsController < ApplicationController @obj_pages = nil @numbers = Setting.tags_show_search_results + # @issues_results = get_issues_by_tag($selected_tags) # @projects_results = get_projects_by_tag($selected_tags) # @users_results = get_users_by_tag($selected_tags) @@ -201,8 +206,8 @@ class TagsController < ApplicationController def count(name) end - def show - + def show_all + @tags = ActsAsTaggableOn::Tag.find(:all) end def for_pagination(results) @@ -212,5 +217,25 @@ class TagsController < ApplicationController @offset ||= @obj_pages.offset results = results.offset(@offset).limit(@limit).order('lft').all 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 diff --git a/app/views/tags/_delete.js.erb b/app/views/tags/_delete.js.erb new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/app/views/tags/_delete.js.erb @@ -0,0 +1 @@ + diff --git a/app/views/tags/show_all.html.erb b/app/views/tags/show_all.html.erb index bcdc7fd31..8dde3ba9e 100644 --- a/app/views/tags/show_all.html.erb +++ b/app/views/tags/show_all.html.erb @@ -1,5 +1,12 @@ +<% content_for :content do %> +