Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes taggable issue with recent wiki controller changes #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/redmine_tagging/patches/wiki_page_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
24 changes: 0 additions & 24 deletions lib/tagging_plugin/tagging_patches.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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