diff --git a/lib/redmine_tagging/patches/wiki_page_patch.rb b/lib/redmine_tagging/patches/wiki_page_patch.rb index 47f8ec0..16bd624 100644 --- a/lib/redmine_tagging/patches/wiki_page_patch.rb +++ b/lib/redmine_tagging/patches/wiki_page_patch.rb @@ -6,11 +6,10 @@ module RedmineTagging::Patches::WikiPagePatch included do unloadable - attr_writer :tags_to_update - has_many :wiki_page_tags acts_as_taggable + safe_attributes :tags before_save :update_tags @@ -32,6 +31,12 @@ module RedmineTagging::Patches::WikiPagePatch end end + def tags=(new_tags) + if new_tags + @tags_to_update = TaggingPlugin::TagsHelper.from_string(new_tags) + end + end + private def update_tags diff --git a/lib/tagging_plugin/tagging_patches.rb b/lib/tagging_plugin/tagging_patches.rb index bfd79e7..e3e75fc 100755 --- a/lib/tagging_plugin/tagging_patches.rb +++ b/lib/tagging_plugin/tagging_patches.rb @@ -18,30 +18,6 @@ def project_settings_tabs_with_tags_tab end end - module WikiControllerPatch - def self.included(base) # :nodoc: - base.send(:include, InstanceMethods) - - base.class_eval do - unloadable - - alias_method_chain :update, :tags - end - end - - module InstanceMethods - def update_with_tags - if params[:wiki_page] - if tags = params[:wiki_page][:tags] - tags = TagsHelper.from_string(tags) - @page.tags_to_update = tags - end - end - update_without_tags - end - end - end end -WikiController.send(:include, TaggingPlugin::WikiControllerPatch) unless WikiController.included_modules.include? TaggingPlugin::WikiControllerPatch ProjectsHelper.send(:include, TaggingPlugin::ProjectsHelperPatch) unless ProjectsHelper.included_modules.include? TaggingPlugin::ProjectsHelperPatch