redmine修改-自动添加观察者
编辑问题时将当前用户自动添加为观察者
文件:
app/controllers/issues_controller.rb
else
respond_to do |format|
format.html { render :action => 'edit' }
format.api { render_validation_errors(@issue) }
end
end
#for watcher
klass = Object.const_get('issue'.camelcase) rescue nil
watchables = klass.where(:id => Array.wrap(params[:id])).to_a
watchables.each do |watchable|
watchable.set_watcher(User.current, true)
end
#end for watcher
end
# Bulk edit/copy a set of issues
def bulk_edit
同时在“我的工作台”默认模板中添加“跟踪的问题”
文件:app/controllers/my_controller.rb
BLOCKS = { 'issuesassignedtome' => :label_assigned_to_me_issues,
'issuesreportedbyme' => :label_reported_issues,
'issueswatched' => :label_watched_issues,
'news' => :label_news_latest,
'calendar' => :label_calendar,
'documents' => :label_document_plural,
'timelog' => :label_spent_time
}.merge(Redmine::Views::MyPage::Block.additional_blocks).freeze
# 修改的位置
DEFAULT_LAYOUT = { 'left' => ['issuesassignedtome'],
'right' => ['issuesreportedbyme','issueswatched']
}.freeze
def index
page
render :action => 'page'
end