Index: app/views/issue_watchers/_form.rhtml
===================================================================
--- app/views/issue_watchers/_form.rhtml (revision 1607)
+++ app/views/issue_watchers/_form.rhtml (working copy)
@@ -1,12 +1,12 @@
-<%= error_messages_for 'relation' %>
+<%= error_messages_for 'watchers' %>
+
+<% @user_list = @project.assignable_users
+for @user in @issue.watchers.collect(&:user)
+ @user_list.delete(@user)
+end
-
<%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
-<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 6 %>
-
-<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
-
+%>
+<%= f.select :watcher_id, (@user_list.collect {|m| [m.name, m.id]}), :include_blank => true %>
<%= submit_tag l(:button_add) %>
-<%= toggle_link l(:button_cancel), 'new-relation-form'%>
+<%= toggle_link l(:button_cancel), 'new-watcher-form'%>
-
-<%= javascript_tag "setPredecessorFieldsVisibility();" %>
Index: app/views/issues/_watchers.rhtml
===================================================================
--- app/views/issues/_watchers.rhtml (revision 0)
+++ app/views/issues/_watchers.rhtml (revision 0)
@@ -0,0 +1,13 @@
+
+ <% watchers = @issue.watchers.collect(&:user).uniq
+ for user in watchers %>
+ <%= link_to_user(user)%>,
+ <% end %>
+ <% remote_form_for(:watchers, @watchers,
+ :url => {:controller => 'watchers', :action => 'add_user', :object_type => 'issue', :object_id => @issue, :issue => @issue},
+ :method => :post,
+ :html => {:id => 'new-watcher-form', :style => (@watchers ? '' : 'display: none;')}) do |f| %>
+ <%= render :partial => 'issue_watchers/form', :locals => {:f => f}%>
+ <% end %>
+
+
Index: app/views/issues/show.rhtml
===================================================================
--- app/views/issues/show.rhtml (revision 1709)
+++ app/views/issues/show.rhtml (working copy)
@@ -43,6 +43,12 @@
<% end %>
+ <%=l(:field_watchers)%> : <%= show_and_goto_link(l(:button_add_watcher), 'new-watcher-form', :class => 'icon icon-add', :accesskey => accesskey(:watchers)) %> |
+
+ <%= render :partial => 'watchers' %>
+ |
+
+
<% n = 0
for custom_value in @custom_values %>
<%= custom_value.custom_field.name %> : | <%= simple_format(h(show_value(custom_value))) %> |
Index: app/controllers/watchers_controller.rb
===================================================================
--- app/controllers/watchers_controller.rb (revision 1709)
+++ app/controllers/watchers_controller.rb (working copy)
@@ -27,6 +27,20 @@
format.js { render(:update) {|page| page.replace_html 'watcher', watcher_link(@watched, user)} }
end
end
+
+ def add_user
+ @issue = Issue.find(params[:object_id])
+ @user = User.find(params[:watchers][:watcher_id])
+ @watched.add_watcher(@user)
+ respond_to do |format|
+ format.html { redirect_to :controller => 'issues', :action => 'show', :id => @issue }
+ format.js do
+ render :update do |page|
+ page.replace_html "watchers", :partial => 'issues/watchers'
+ end
+ end
+ end
+ end
def remove
user = User.current
Index: lang/en.yml
===================================================================
--- lang/en.yml (revision 1709)
+++ lang/en.yml (working copy)
@@ -179,6 +179,7 @@
field_searchable: Searchable
field_default_value: Default value
field_comments_sorting: Display comments
+field_watchers: Watchers
setting_app_title: Application title
setting_app_subtitle: Application subtitle
@@ -548,6 +549,8 @@
button_annotate: Annotate
button_update: Update
button_configure: Configure
+button_add_watcher: Add
status_active: active
status_registered: registered