Merged r3934 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3984 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Eric Davis 2010-08-19 04:33:05 +00:00
parent 7ca197b37f
commit 5345a2dd89
2 changed files with 32 additions and 16 deletions

View File

@ -141,6 +141,7 @@ class GroupsController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group) @membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
@membership.save if request.post? @membership.save if request.post?
respond_to do |format| respond_to do |format|
if @membership.valid?
format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' } format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
format.js { format.js {
render(:update) {|page| render(:update) {|page|
@ -148,6 +149,13 @@ class GroupsController < ApplicationController
page.visual_effect(:highlight, "member-#{@membership.id}") page.visual_effect(:highlight, "member-#{@membership.id}")
} }
} }
else
format.js {
render(:update) {|page|
page.alert(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')))
}
}
end
end end
end end

View File

@ -123,6 +123,7 @@ class UsersController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @user) @membership = Member.edit_membership(params[:membership_id], params[:membership], @user)
@membership.save if request.post? @membership.save if request.post?
respond_to do |format| respond_to do |format|
if @membership.valid?
format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' } format.html { redirect_to :controller => 'users', :action => 'edit', :id => @user, :tab => 'memberships' }
format.js { format.js {
render(:update) {|page| render(:update) {|page|
@ -130,6 +131,13 @@ class UsersController < ApplicationController
page.visual_effect(:highlight, "member-#{@membership.id}") page.visual_effect(:highlight, "member-#{@membership.id}")
} }
} }
else
format.js {
render(:update) {|page|
page.alert(l(:notice_failed_to_save_members, :errors => @membership.errors.full_messages.join(', ')))
}
}
end
end end
end end