组织加入成员时,如果没有选择用户,弹窗给出提示
This commit is contained in:
parent
2a5eeaa527
commit
5aea2250c4
|
@ -10,12 +10,16 @@ class OrgMemberController < ApplicationController
|
|||
|
||||
def create
|
||||
@org = Organization.find(params[:org])
|
||||
member_ids = params[:membership][:user_ids]
|
||||
role_id = params[:orgRole]
|
||||
member_ids.each do |user_id|
|
||||
member = OrgMember.create(:user_id=>user_id)
|
||||
@org.org_members << member
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
|
||||
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|
|
||||
member = OrgMember.create(:user_id=>user_id)
|
||||
@org.org_members << member
|
||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
|
@ -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 %>
|
|
@ -2091,5 +2091,6 @@ zh:
|
|||
label_language: 语言
|
||||
label_license: 湘ICP备09019772
|
||||
label_org_name: 组织名称:
|
||||
label_blank_user_lists_for_org: 您还没有选择用户
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue