Added a warning when a new user or group membership is invalid. #3834
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3934 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
83e4cf3dd4
commit
0cfa757db0
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue