Revision 1258:f8c5708a6fd6 plugins/redmine_tags
| plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb | ||
|---|---|---|
| 103 | 103 |
def filter_projects |
| 104 | 104 |
# find projects like question |
| 105 | 105 |
@question = (params[:search] || "").strip |
| 106 |
# |
|
| 107 |
# if params.has_key?(:project) |
|
| 108 |
# @tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 109 |
# else |
|
| 110 |
# @tag_list = [] |
|
| 111 |
# end |
|
| 112 |
# |
|
| 113 |
# if @question == "" |
|
| 114 |
# @projects = Project.visible_roots |
|
| 115 |
# else |
|
| 116 |
# @projects = Project.visible_roots.find(Project.visible.like(@question)) |
|
| 117 |
# end |
|
| 118 |
# |
|
| 119 |
# unless @tag_list.empty? |
|
| 120 |
# @tagged_projects_ids = Project.visible.tagged_with(@tag_list).collect{ |# project| Project.find(project.id).root }
|
|
| 121 |
# |
|
| 122 |
# @projects = @projects & @tagged_projects_ids |
|
| 123 |
# @projects = @projects.uniq |
|
| 124 |
# end |
|
| 125 | 106 |
|
| 126 |
# hack... |
|
| 127 |
@projects = Project.like(@question) |
|
| 107 |
if @question.empty? |
|
| 108 |
projects = Project.visible |
|
| 109 |
else |
|
| 110 |
projects = Project.visible.like(@question) |
|
| 111 |
end |
|
| 112 |
|
|
| 113 |
# search for tags |
|
| 114 |
if params.has_key?(:project) |
|
| 115 |
tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 116 |
else |
|
| 117 |
tag_list = "" |
|
| 118 |
end |
|
| 119 |
|
|
| 120 |
unless tag_list.empty? |
|
| 121 |
projects = projects.tagged_with(tag_list) |
|
| 122 |
end |
|
| 123 |
|
|
| 124 |
## TODO: luisf-10Apr2013 should I only return the visible_roots? |
|
| 125 |
@projects = projects |
|
| 128 | 126 |
|
| 129 | 127 |
end |
| 130 | 128 |
end |
Also available in: Unified diff