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

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

View File

@ -1,2 +1,6 @@
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>'); <% if @fail_hint %>
$("#principals_for_new_member").html('') 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_language: 语言
label_license: 湘ICP备09019772 label_license: 湘ICP备09019772
label_org_name: 组织名称: label_org_name: 组织名称:
label_blank_user_lists_for_org: 您还没有选择用户