# HG changeset patch # User Luis Figueira # Date 1320081060 0 # Node ID 4a9bb3b8d5cdcd6ec1f780ceeecf81da9e14fd59 # Parent 291c4d7dc0b67089bdfdf2a99a6a71dad7bfe240 Patching the projects controller in order to have access to the params hash before saving (new, update actions) the project model. diff -r 291c4d7dc0b6 -r 4a9bb3b8d5cd vendor/plugins/redmine_tags/init.rb --- a/vendor/plugins/redmine_tags/init.rb Thu Oct 27 19:17:17 2011 +0100 +++ b/vendor/plugins/redmine_tags/init.rb Mon Oct 31 17:11:00 2011 +0000 @@ -53,6 +53,10 @@ IssuesHelper.send(:include, RedmineTags::Patches::IssuesHelperPatch) end + unless ProjectsController.included_modules.include?(RedmineTags::Patches::ProjectsControllerPatch) + ProjectsController.send(:include, RedmineTags::Patches::ProjectsControllerPatch) + end + unless AutoCompletesController.included_modules.include?(RedmineTags::Patches::AutoCompletesControllerPatch) AutoCompletesController.send(:include, RedmineTags::Patches::AutoCompletesControllerPatch) end diff -r 291c4d7dc0b6 -r 4a9bb3b8d5cd vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb --- a/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Thu Oct 27 19:17:17 2011 +0100 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/project_patch.rb Mon Oct 31 17:11:00 2011 +0000 @@ -7,18 +7,27 @@ module ProjectPatch def self.included(base) # :nodoc: base.extend(ClassMethods) + base.send(:include, InstanceMethods) base.class_eval do unloadable + + attr_accessor :tag_list + acts_as_taggable - alias_method_chain :before_save, :save_tags + end end - def before_save_with_save_tags(context={}) + def before_save_with_save_tags() +# debugger + logger.error { "GONNA SAVE TAG LIST" } - logger.error { "GONNA SAVE TAG LIST" } - logger.error { @project.name } + +# params[:tag_list] + + + # logger.error { @project.name } # if params && params[:project] && !params[:project][:tag_list].nil? # old_tags = context[:project].tag_list.to_s @@ -34,7 +43,9 @@ # end end - + module InstanceMethods + + end module ClassMethods # Returns available issue tags diff -r 291c4d7dc0b6 -r 4a9bb3b8d5cd vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/plugins/redmine_tags/lib/redmine_tags/patches/projects_controller_patch.rb Mon Oct 31 17:11:00 2011 +0000 @@ -0,0 +1,28 @@ +require_dependency 'projects_controller' + +module RedmineTags + module Patches + module ProjectsControllerPatch + def self.included(base) + base.send(:include, InstanceMethods) + base.class_eval do + unloadable + before_filter :add_tags_to_project, :only => [:save, :update] + end + end + + module InstanceMethods + + + def add_tags_to_project +# debugger + logger.error { "TAG_LIST-->#{params[:project][:tag_list]}" } + end + end + end + end +end + + + +