summaryrefslogtreecommitdiffstats
path: root/app/controllers/issues_controller.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-04 08:52:51 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-04 08:52:51 +0000
commit1269e6c7d3f5e067f4a77d78b66a8149255dd00a (patch)
tree5d8ef9fe1b13e7a0c9ac22784e743c20688361e5 /app/controllers/issues_controller.rb
parented18b3359b6d4fc4b9a8d81c310a6bf8d01ef9ce (diff)
downloadredmine-1269e6c7d3f5e067f4a77d78b66a8149255dd00a.tar.gz
redmine-1269e6c7d3f5e067f4a77d78b66a8149255dd00a.zip
Display the bulk edit form with error messages when some issues can not be saved (#13943).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11786 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/issues_controller.rb')
-rw-r--r--app/controllers/issues_controller.rb33
1 files changed, 19 insertions, 14 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 3f3966aba..c95e25b12 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -241,7 +241,6 @@ class IssuesController < ApplicationController
end
@safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&)
- render :layout => false if request.xhr?
end
def bulk_update
@@ -249,8 +248,8 @@ class IssuesController < ApplicationController
@copy = params[:copy].present?
attributes = parse_params_for_bulk_issue_attributes(params)
- unsaved_issue_ids = []
- moved_issues = []
+ unsaved_issues = []
+ saved_issues = []
if @copy && params[:copy_subtasks].present?
# Descendant issues will be copied with the parent task
@@ -270,23 +269,29 @@ class IssuesController < ApplicationController
issue.safe_attributes = attributes
call_hook(:controller_issues_bulk_edit_before_save, { :params => params, :issue => issue })
if issue.save
- moved_issues << issue
+ saved_issues << issue
else
- logger.info "issue could not be updated or copied: #{issue.errors.full_messages}" if logger && logger.info
- # Keep unsaved issue ids to display them in flash error
- unsaved_issue_ids << issue.id
+ unsaved_issues << issue
end
end
- set_flash_from_bulk_issue_save(@issues, unsaved_issue_ids)
- if params[:follow]
- if @issues.size == 1 && moved_issues.size == 1
- redirect_to issue_path(moved_issues.first)
- elsif moved_issues.map(&:project).uniq.size == 1
- redirect_to project_issues_path(moved_issues.map(&:project).first)
+ if unsaved_issues.empty?
+ flash[:notice] = l(:notice_successful_update) unless saved_issues.empty?
+ if params[:follow]
+ if @issues.size == 1 && saved_issues.size == 1
+ redirect_to issue_path(saved_issues.first)
+ elsif saved_issues.map(&:project).uniq.size == 1
+ redirect_to project_issues_path(saved_issues.map(&:project).first)
+ end
+ else
+ redirect_back_or_default _project_issues_path(@project)
end
else
- redirect_back_or_default _project_issues_path(@project)
+ @saved_issues = @issues
+ @unsaved_issues = unsaved_issues
+ @issues = Issue.visible.find_all_by_id(@unsaved_issues.map(&:id))
+ bulk_edit
+ render :action => 'bulk_edit'
end
end