Mercurial > hg > soundsoftware-site
changeset 752:ded6cd947ade feature_14
corrected bug in the project's tag link helper.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 10 Nov 2011 12:28:53 +0000 |
parents | 7bf2d69e9aeb |
children | 7877f25a19d6 |
files | vendor/plugins/redmine_tags/app/helpers/tags_helper.rb vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb |
diffstat | 2 files changed, 51 insertions(+), 58 deletions(-) [+] |
line wrap: on
line diff
--- a/vendor/plugins/redmine_tags/app/helpers/tags_helper.rb Thu Nov 10 11:14:52 2011 +0000 +++ b/vendor/plugins/redmine_tags/app/helpers/tags_helper.rb Thu Nov 10 12:28:53 2011 +0000 @@ -41,9 +41,7 @@ end def render_project_tag_link(tag) - - content = link_to tag.name, application_path(:controller => :projects, :action => :index, :project => {:tag_list => tag.name}), - + content = link_to tag.name, :controller => :projects, :action => :index, :project => { :tag_list => tag.name } content_tag('span', content, :class => 'tag-label') end
--- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Thu Nov 10 11:14:52 2011 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Thu Nov 10 12:28:53 2011 +0000 @@ -13,76 +13,71 @@ end module InstanceMethods - def add_tags_to_project + def add_tags_to_project + if params && params[:project] && !params[:project][:tag_list].nil? old_tags = @project.tag_list.to_s new_tags = params[:project][:tag_list].to_s - + unless (old_tags == new_tags) @project.tag_list = new_tags end end end - - - def calculate_project_filtering_settings - @project_filtering_settings = Setting[:plugin_redmine_project_filtering] + + # luisf - TO BE REMOVED? + def calculate_project_filtering_settings + @project_filtering_settings = Setting[:plugin_redmine_project_filtering] + end + + def filter_projects + @project = Project.new + + respond_to do |format| + format.any(:html, :xml) { + calculate_filtered_projects + } + format.js { + calculate_filtered_projects + render :update do |page| + page.replace_html 'projects', :partial => 'filtered_projects' + end + } + format.atom { + projects = Project.visible.find(:all, :order => 'created_on DESC', + :limit => Setting.feeds_limit.to_i) + render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") + } + end + end + + private + + def calculate_filtered_projects + @question = (params[:q] || "").strip + + if params.has_key?(:project) + @tag_list = (params[:project][:tag_list] || "").strip.split(",") + else + @tag_list = [] end - def filter_projects - logger.error { "before_filter: filter_projects" } + @projects = Project.visible - @project = Project.new - - respond_to do |format| - format.any(:html, :xml) { - calculate_filtered_projects - } - format.js { - calculate_filtered_projects - render :update do |page| - page.replace_html 'projects', :partial => 'filtered_projects' - end - } - format.atom { - projects = Project.visible.find(:all, :order => 'created_on DESC', - :limit => Setting.feeds_limit.to_i) - render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}") - } - end - end + @featured_projects = @projects.featured if Project.respond_to? :featured - private + # luisf + @projects = @projects.search_by_question(@question) unless @question == "" + @tagged_projects_ids = Project.tagged_with(@tag_list).collect{ |project| Project.find(project.id) } unless @tag_list.empty? - def calculate_filtered_projects + # intersection of both prject groups + @projects = @projects && @tagged_projects_ids unless @tag_list.empty? - @question = (params[:q] || "").strip + # luisf: what exactly are the featured projects? could they be "my projects"? + # if not should remove this code⦠+ @featured_projects = @featured_projects.search_by_question(@question) if @featured_projects - if params.has_key?(:project) - @tag_list = (params[:project][:tag_list] || "").strip.split(",") - else - @tag_list = [] - end - - @projects = Project.visible - - @featured_projects = @projects.featured if Project.respond_to? :featured - - # luisf - @projects = @projects.search_by_question(@question) unless @question == "" - @tagged_projects_ids = Project.tagged_with(@tag_list).collect{ |project| Project.find(project.id) } unless @tag_list.empty? - - # intersection of both prject groups - @projects = @projects && @tagged_projects_ids unless @tag_list.empty? - - # luisf: what exactly are the featured projects? could they be "my projects"? - @featured_projects = @featured_projects.search_by_question(@question) if @featured_projects - - end - - - - + end end end end