Ability to add non-member users as watchers (#5159).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8592 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-01-09 18:37:16 +00:00
parent c22f60271f
commit 1b1c510ff9
9 changed files with 101 additions and 28 deletions
+1
View File
@@ -73,6 +73,7 @@
</div>
<div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="footer">
<div class="bgl"><div class="bgr">
+30
View File
@@ -0,0 +1,30 @@
<h3 class="title"><%= l(:permission_add_issue_watchers) %></h3>
<% form_remote_tag :url => {:controller => 'watchers',
:action => 'create',
:object_type => watched.class.name.underscore,
:object_id => watched},
:method => :post,
:html => {:id => 'new-watcher-form'} do %>
<p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p>
<%= observe_field(:user_search,
:frequency => 0.5,
:update => :users_for_watcher,
:method => :get,
:url => {
:controller => 'watchers',
:action => 'autocomplete_for_user',
:object_type => watched.class.name.underscore,
:object_id => watched},
:with => 'q') %>
<div id="users_for_watcher">
<%= principals_check_box_tags 'watcher[user_ids][]', watched.addable_watcher_users %>
</div>
<p class="buttons">
<%= submit_tag l(:button_add), :name => nil, :onclick => "hideModal(this);" %>
<%= submit_tag l(:button_cancel), :name => nil, :onclick => "hideModal(this);", :type => 'button' %>
</p>
<% end %>
+4 -16
View File
@@ -1,26 +1,14 @@
<% if User.current.allowed_to?(:add_issue_watchers, @project) %>
<div class="contextual">
<%= link_to_remote l(:button_add),
:url => {:controller => 'watchers',
:action => 'new',
:object_type => watched.class.name.underscore,
:object_id => watched} if User.current.allowed_to?(:add_issue_watchers, @project) %>
:object_id => watched},
:method => 'get' %>
</div>
<% end %>
<h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3>
<% unless @watcher.nil? %>
<% remote_form_for(:watcher, @watcher,
:url => {:controller => 'watchers',
:action => 'new',
:object_type => watched.class.name.underscore,
:object_id => watched},
:method => :post,
:html => {:id => 'new-watcher-form'}) do |f| %>
<p><%= f.select :user_id, (watched.addable_watcher_users.collect {|m| [m.name, m.id]}), :prompt => "--- #{l(:actionview_instancetag_blank_option)} ---" %>
<%= submit_tag l(:button_add) %>
<%= toggle_link l(:button_cancel), 'new-watcher-form'%></p>
<% end %>
<% end %>
<%= watchers_list(watched) %>
@@ -0,0 +1 @@
<%= principals_check_box_tags 'watcher[user_ids][]', @users %>