change author
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# location lib/plugins/assign_author/hook.rb | |
#如果使用者想要透過webservice指定作者的話,http 參數給予author_login即可。 | |
# 此欄位為user table的 login欄位 | |
module AssignAuthor | |
class Hooks < Redmine::Hook::ViewListener | |
def controller_issues_new_before_save(context={}) | |
if context[:params]["author_login"] | |
u=User.find_by_login(context[:params]["author_login"]) | |
context[:issue].author = u | |
end | |
return '' | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#location: config/initializers/init.rb | |
require 'redmine' | |
require_dependency 'plugins/assign_author/hook' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
收到!