组织加入成员时,如果没有选择用户,弹窗给出提示

This commit is contained in:
ouyangxuhua 2015-11-13 10:14:38 +08:00
parent 2a5eeaa527
commit 5aea2250c4
3 changed files with 17 additions and 8 deletions

View File

@ -10,6 +10,9 @@ class OrgMemberController < ApplicationController
def create
@org = Organization.find(params[:org])
if params[:membership].nil?
@fail_hint = l(:label_blank_user_lists_for_org)
else
member_ids = params[:membership][:user_ids]
role_id = params[:orgRole]
member_ids.each do |user_id|
@ -17,6 +20,7 @@ class OrgMemberController < ApplicationController
@org.org_members << member
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
end
end
respond_to do |format|
format.js
end

View File

@ -1,2 +1,6 @@
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
$("#principals_for_new_member").html('')
<% if @fail_hint %>
alert("<%= @fail_hint %>");
<% else %>
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
$("#principals_for_new_member").html('');
<% end %>

View File

@ -2091,5 +2091,6 @@ zh:
label_language: 语言
label_license: 湘ICP备09019772
label_org_name: 组织名称:
label_blank_user_lists_for_org: 您还没有选择用户