diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-09 07:37:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-04-09 07:37:49 +0000 |
commit | 5adc1ddde9b4a353b2d2a499004c2025d6e8847a (patch) | |
tree | 157cb8f2a52a443b0b91beb2d43d70733e0e62cc /app/views/watchers | |
parent | c8c694840d3c16450371141be609fd6b6e023667 (diff) | |
download | redmine-5adc1ddde9b4a353b2d2a499004c2025d6e8847a.tar.gz redmine-5adc1ddde9b4a353b2d2a499004c2025d6e8847a.zip |
Allow addition of watchers via bulk edit context menu (#5754).
git-svn-id: http://svn.redmine.org/redmine/trunk@15311 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/watchers')
-rw-r--r-- | app/views/watchers/_new.html.erb | 18 | ||||
-rw-r--r-- | app/views/watchers/create.js.erb | 7 | ||||
-rw-r--r-- | app/views/watchers/destroy.js.erb | 4 | ||||
-rw-r--r-- | app/views/watchers/new.js.erb | 2 |
4 files changed, 20 insertions, 11 deletions
diff --git a/app/views/watchers/_new.html.erb b/app/views/watchers/_new.html.erb index 6282d59aa..3640c6993 100644 --- a/app/views/watchers/_new.html.erb +++ b/app/views/watchers/_new.html.erb @@ -1,19 +1,23 @@ <h3 class="title"><%= l(:permission_add_issue_watchers) %></h3> -<%= form_tag({:controller => 'watchers', - :action => (watched ? 'create' : 'append'), - :object_type => (watched && watched.class.name.underscore), - :object_id => watched, - :project_id => @project}, +<%= form_tag(watchables.present? ? watchers_path : watchers_append_path, :remote => true, :method => :post, :id => 'new-watcher-form') do %> + <% if watchables.present? %> + <%= hidden_field_tag 'object_type', watchables.first.class.name.underscore %> + <% watchables.each do |watchable| %> + <%= hidden_field_tag 'object_id[]', watchable.id %> + <% end %> + <% end %> + <%= hidden_field_tag 'project_id', @project.id if @project %> + <p><%= label_tag 'user_search', l(:label_user_search) %><%= text_field_tag 'user_search', nil %></p> <%= javascript_tag "observeSearchfield('user_search', 'users_for_watcher', '#{ escape_javascript url_for(:controller => 'watchers', :action => 'autocomplete_for_user', - :object_type => (watched && watched.class.name.underscore), - :object_id => watched, + :object_type => (watchables.present? ? watchables.first.class.name.underscore : nil), + :object_id => (watchables.present? && watchables.size == 1 ? watchables.first.id : nil), :project_id => @project) }')" %> <div id="users_for_watcher"> diff --git a/app/views/watchers/create.js.erb b/app/views/watchers/create.js.erb index ba8e580af..dd9d8502f 100644 --- a/app/views/watchers/create.js.erb +++ b/app/views/watchers/create.js.erb @@ -1,2 +1,5 @@ -$('#ajax-modal').html('<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watched => @watched, :users => @users})) %>'); -$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); +$('#ajax-modal').html('<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watchables => @watchables, :users => @users})) %>'); + +<% if @watchables.size == 1 %> +$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watchables.first})) %>'); +<% end %> diff --git a/app/views/watchers/destroy.js.erb b/app/views/watchers/destroy.js.erb index e4d856549..413797dc2 100644 --- a/app/views/watchers/destroy.js.erb +++ b/app/views/watchers/destroy.js.erb @@ -1 +1,3 @@ -$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); +<% if @watchables.size == 1 %> +$('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watchables.first})) %>'); +<% end %> diff --git a/app/views/watchers/new.js.erb b/app/views/watchers/new.js.erb index 8ff5dacc9..a4a91a765 100644 --- a/app/views/watchers/new.js.erb +++ b/app/views/watchers/new.js.erb @@ -1,3 +1,3 @@ -$('#ajax-modal').html('<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watched => @watched, :users => @users}) %>'); +$('#ajax-modal').html('<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watchables => @watchables, :users => @users}) %>'); showModal('ajax-modal', '400px'); $('#ajax-modal').addClass('new-watcher'); |