diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index ba01aa990..1318e40a5 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -71,8 +71,8 @@ class TagsController < ApplicationController @projects_results, @issues_results, @bids_results, - @forums_results, - attachments_results, + @forums_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags) @@ -107,8 +107,8 @@ class TagsController < ApplicationController @projects_results, @issues_results, @bids_results, - @forums_results, - attachments_results, + @forums_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results= refresh_results(@obj_id,@show_flag) @@ -130,8 +130,8 @@ class TagsController < ApplicationController @projects_results, @issues_results, @bids_results, - @forums_results, - attachments_results, + @forums_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results= refresh_results(@obj_id,@show_flag) @@ -199,7 +199,7 @@ class TagsController < ApplicationController @bids_results = nil @contests_results = nil @forums_results = nil - attachments_results = nil + @attachments_results = nil @open_source_projects_results = nil @obj_pages = nil @obj = nil @@ -228,8 +228,9 @@ class TagsController < ApplicationController # modifed by Long Jun # this is used to find the attachments that came from the same project and tagged with the same tag. - @result = get_attachments_by_project_tag(selected_tags, @obj) - @obj_pages, attachments_results, @results_count = for_pagination(@result) + #@result = get_attachments_by_project_tag(selected_tags, @obj) + @result = get_attachments_by_tag(selected_tags) + @obj_pages, @attachments_results, @results_count = for_pagination(@result) when '7' @obj = Contest.find_by_id(obj_id) @obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags)) @@ -249,8 +250,8 @@ class TagsController < ApplicationController @projects_results, @issues_results, @bids_results, - @forums_results, - attachments_results, + @forums_results, + @attachments_results, @contests_results, @courses_results, @open_source_projects_results] diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb index b43eb22f1..ee9d2a70d 100644 --- a/app/helpers/attachments_helper.rb +++ b/app/helpers/attachments_helper.rb @@ -87,8 +87,9 @@ module AttachmentsHelper @project_id = obj.container_id end - Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or + attachments = Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or (container_id in (select id from versions where project_id =:project_id) and container_type = 'Version')", {:project_id => @project_id}) + return attachments end diff --git a/app/views/tags/_show_attachments.html.erb b/app/views/tags/_show_attachments.html.erb index 43ed76e02..8b0bb1f8b 100644 --- a/app/views/tags/_show_attachments.html.erb +++ b/app/views/tags/_show_attachments.html.erb @@ -1,5 +1,5 @@