修改缺陷时增加跟踪者的删除和增加功能

This commit is contained in:
sw 2014-07-15 15:09:52 +08:00
parent b142953a4b
commit 121ffa0342
2 changed files with 40 additions and 0 deletions

View File

@ -119,6 +119,7 @@ class IssuesController < ApplicationController
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
respond_to do |format|
format.html {
@ -194,6 +195,30 @@ class IssuesController < ApplicationController
end
if saved
#修改界面增加跟踪者
watcherlist = @issue.watcher_users
select_users = []
if params[:issue]
if params[:issue][:watcher_user_ids]
params[:issue][:watcher_user_ids].each do |user_id|
select_users << User.find(user_id)
end
end
end
select_users.each do |user|
if watcherlist.include? user
else
@issue.add_watcher user
end
end
watcherlist.each do |user|
if select_users.include? user
else
@issue.remove_watcher user
end
end
render_attachment_warning_if_needed(@issue)
reply_id = params[:reference_user_id].to_i
if reply_id > 0

View File

@ -24,6 +24,21 @@
<fieldset><legend><%= l(:label_attachment_plural) %></legend>
<p><%= render :partial => 'attachments/form', :locals => {:container => @issue} %></p>
</fieldset>
<div class="box tabular" >
<p id="watchers_form">
<label style="font-size: 15px;"><%= l(:label_issue_watchers) %></label>
<span id="watchers_inputs" style="font-size: 15px;">
<%= watchers_checkboxes(@issue, @available_watchers) %>
</span>
<span class="search_for_watchers" style="font-size: 15px;">
<%= link_to l(:label_search_for_watchers),
{:controller => 'watchers', :action => 'new', :project_id => @issue.project},
:remote => true,
:method => 'get' %>
</span>
</p>
</div>
</div>
<%= f.hidden_field :lock_version %>