From 121ffa0342cdab227a90e72664743de22a97344e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 15 Jul 2014 15:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BC=BA=E9=99=B7=E6=97=B6?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B7=9F=E8=B8=AA=E8=80=85=E7=9A=84=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=92=8C=E5=A2=9E=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/issues_controller.rb | 25 +++++++++++++++++++++++++ app/views/issues/_edit.html.erb | 15 +++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 2f7d6e600..edff1888b 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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 diff --git a/app/views/issues/_edit.html.erb b/app/views/issues/_edit.html.erb index 4c379ae54..8037bee01 100644 --- a/app/views/issues/_edit.html.erb +++ b/app/views/issues/_edit.html.erb @@ -24,6 +24,21 @@
<%= l(:label_attachment_plural) %>

<%= render :partial => 'attachments/form', :locals => {:container => @issue} %>

+ +
+

+ + + <%= watchers_checkboxes(@issue, @available_watchers) %> + + + <%= link_to l(:label_search_for_watchers), + {:controller => 'watchers', :action => 'new', :project_id => @issue.project}, + :remote => true, + :method => 'get' %> + +

+
<%= f.hidden_field :lock_version %>