Revision 752:ded6cd947ade vendor/plugins/redmine_tags/lib/redmine_tags
| vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb | ||
|---|---|---|
| 13 | 13 |
end |
| 14 | 14 |
|
| 15 | 15 |
module InstanceMethods |
| 16 |
def add_tags_to_project |
|
| 16 |
def add_tags_to_project |
|
| 17 |
|
|
| 17 | 18 |
if params && params[:project] && !params[:project][:tag_list].nil? |
| 18 | 19 |
old_tags = @project.tag_list.to_s |
| 19 | 20 |
new_tags = params[:project][:tag_list].to_s |
| 20 |
|
|
| 21 |
|
|
| 21 | 22 |
unless (old_tags == new_tags) |
| 22 | 23 |
@project.tag_list = new_tags |
| 23 | 24 |
end |
| 24 | 25 |
end |
| 25 | 26 |
end |
| 26 |
|
|
| 27 |
|
|
| 28 |
def calculate_project_filtering_settings |
|
| 29 |
@project_filtering_settings = Setting[:plugin_redmine_project_filtering] |
|
| 27 |
|
|
| 28 |
# luisf - TO BE REMOVED? |
|
| 29 |
def calculate_project_filtering_settings |
|
| 30 |
@project_filtering_settings = Setting[:plugin_redmine_project_filtering] |
|
| 31 |
end |
|
| 32 |
|
|
| 33 |
def filter_projects |
|
| 34 |
@project = Project.new |
|
| 35 |
|
|
| 36 |
respond_to do |format| |
|
| 37 |
format.any(:html, :xml) {
|
|
| 38 |
calculate_filtered_projects |
|
| 39 |
} |
|
| 40 |
format.js {
|
|
| 41 |
calculate_filtered_projects |
|
| 42 |
render :update do |page| |
|
| 43 |
page.replace_html 'projects', :partial => 'filtered_projects' |
|
| 44 |
end |
|
| 45 |
} |
|
| 46 |
format.atom {
|
|
| 47 |
projects = Project.visible.find(:all, :order => 'created_on DESC', |
|
| 48 |
:limit => Setting.feeds_limit.to_i) |
|
| 49 |
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
|
| 50 |
} |
|
| 51 |
end |
|
| 52 |
end |
|
| 53 |
|
|
| 54 |
private |
|
| 55 |
|
|
| 56 |
def calculate_filtered_projects |
|
| 57 |
@question = (params[:q] || "").strip |
|
| 58 |
|
|
| 59 |
if params.has_key?(:project) |
|
| 60 |
@tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 61 |
else |
|
| 62 |
@tag_list = [] |
|
| 30 | 63 |
end |
| 31 | 64 |
|
| 32 |
def filter_projects |
|
| 33 |
logger.error { "before_filter: filter_projects" }
|
|
| 65 |
@projects = Project.visible |
|
| 34 | 66 |
|
| 35 |
@project = Project.new |
|
| 36 |
|
|
| 37 |
respond_to do |format| |
|
| 38 |
format.any(:html, :xml) {
|
|
| 39 |
calculate_filtered_projects |
|
| 40 |
} |
|
| 41 |
format.js {
|
|
| 42 |
calculate_filtered_projects |
|
| 43 |
render :update do |page| |
|
| 44 |
page.replace_html 'projects', :partial => 'filtered_projects' |
|
| 45 |
end |
|
| 46 |
} |
|
| 47 |
format.atom {
|
|
| 48 |
projects = Project.visible.find(:all, :order => 'created_on DESC', |
|
| 49 |
:limit => Setting.feeds_limit.to_i) |
|
| 50 |
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
|
|
| 51 |
} |
|
| 52 |
end |
|
| 53 |
end |
|
| 67 |
@featured_projects = @projects.featured if Project.respond_to? :featured |
|
| 54 | 68 |
|
| 55 |
private |
|
| 69 |
# luisf |
|
| 70 |
@projects = @projects.search_by_question(@question) unless @question == "" |
|
| 71 |
@tagged_projects_ids = Project.tagged_with(@tag_list).collect{ |project| Project.find(project.id) } unless @tag_list.empty?
|
|
| 56 | 72 |
|
| 57 |
def calculate_filtered_projects |
|
| 73 |
# intersection of both prject groups |
|
| 74 |
@projects = @projects && @tagged_projects_ids unless @tag_list.empty? |
|
| 58 | 75 |
|
| 59 |
@question = (params[:q] || "").strip |
|
| 76 |
# luisf: what exactly are the featured projects? could they be "my projects"? |
|
| 77 |
# if not should remove this code⦠|
|
| 78 |
@featured_projects = @featured_projects.search_by_question(@question) if @featured_projects |
|
| 60 | 79 |
|
| 61 |
if params.has_key?(:project) |
|
| 62 |
@tag_list = (params[:project][:tag_list] || "").strip.split(",")
|
|
| 63 |
else |
|
| 64 |
@tag_list = [] |
|
| 65 |
end |
|
| 66 |
|
|
| 67 |
@projects = Project.visible |
|
| 68 |
|
|
| 69 |
@featured_projects = @projects.featured if Project.respond_to? :featured |
|
| 70 |
|
|
| 71 |
# luisf |
|
| 72 |
@projects = @projects.search_by_question(@question) unless @question == "" |
|
| 73 |
@tagged_projects_ids = Project.tagged_with(@tag_list).collect{ |project| Project.find(project.id) } unless @tag_list.empty?
|
|
| 74 |
|
|
| 75 |
# intersection of both prject groups |
|
| 76 |
@projects = @projects && @tagged_projects_ids unless @tag_list.empty? |
|
| 77 |
|
|
| 78 |
# luisf: what exactly are the featured projects? could they be "my projects"? |
|
| 79 |
@featured_projects = @featured_projects.search_by_question(@question) if @featured_projects |
|
| 80 |
|
|
| 81 |
end |
|
| 82 |
|
|
| 83 |
|
|
| 84 |
|
|
| 85 |
|
|
| 80 |
end |
|
| 86 | 81 |
end |
| 87 | 82 |
end |
| 88 | 83 |
end |
Also available in: Unified diff