Project

General

Profile

Feature #1338 » issue_watchers_management.patch

Patch to add basic watch management to issues in redmine - Bradley Whittington, 2008-07-31 09:33

View differences:

app/views/issue_watchers/_form.rhtml (working copy)
<%= error_messages_for 'relation' %>
<%= error_messages_for 'watchers' %>
<p>
<% @user_list = @project.assignable_users
for @user in @issue.watchers.collect(&:user)
@user_list.delete(@user)
end
<p><%= f.select :relation_type, collection_for_relation_type_select, {}, :onchange => "setPredecessorFieldsVisibility();" %>
<%= l(:label_issue) %> #<%= f.text_field :issue_to_id, :size => 6 %>
<span id="predecessor_fields" style="display:none;">
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
</span>
%>
<%= 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'%>
</p>
<%= javascript_tag "setPredecessorFieldsVisibility();" %>
app/views/issues/_watchers.rhtml (revision 0)
<div id="watchers">
<% watchers = @issue.watchers.collect(&:user).uniq
for user in watchers %>
<span class="user"><%= link_to_user(user)%>, </span>
<% 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 %>
</div>
app/views/issues/show.rhtml (working copy)
<% end %>
</tr>
<tr>
<td valign="top"><b><%=l(:field_watchers)%> :</b> <%= show_and_goto_link(l(:button_add_watcher), 'new-watcher-form', :class => 'icon icon-add', :accesskey => accesskey(:watchers)) %></td>
<td colspan=2>
<%= render :partial => 'watchers' %>
</td>
</tr>
<tr>
<% n = 0
for custom_value in @custom_values %>
<td valign="top"><b><%= custom_value.custom_field.name %> :</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td>
app/controllers/watchers_controller.rb (working copy)
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
lang/en.yml (working copy)
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
......
button_annotate: Annotate
button_update: Update
button_configure: Configure
button_add_watcher: Add
status_active: active
status_registered: registered
(1-1/2)