实现项目成员列表增加成员,以及用户/角色留空时的提示信息
This commit is contained in:
parent
729b28ae43
commit
e4b2092c7f
|
@ -117,9 +117,12 @@ class MembersController < ApplicationController
|
|||
format.html { redirect_to invite_members_project_url(@project) }
|
||||
end
|
||||
else
|
||||
unless members.present? && members.all? {|m| m.valid? }
|
||||
@project_error_message = members.empty? ? l(:label_user_role_null) :members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to_settings_in_projects }
|
||||
format.js { @members = members; @applied_members = applied_members; }
|
||||
format.js
|
||||
format.api {
|
||||
@member = members.first
|
||||
if @member.valid?
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
<%if @project%>
|
||||
$('#tab-content-members').html('<%= escape_javascript(render :partial => 'projects/settings/members') %>');
|
||||
|
||||
<%if !@applied_members%>
|
||||
<% if @members.present? && @members.all? {|m| m.valid? } %>
|
||||
<% @members.each do |member| %>
|
||||
$("#member-<%= member.id %>").effect("highlight");
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if @members %>
|
||||
<% errors = @members.collect {|m| m.errors.full_messages}.flatten.uniq.join(', ')%>
|
||||
alert('<%= raw(escape_javascript(l(:notice_failed_to_save_members, :errors => errors || ''))) %>');
|
||||
<% end%>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @project_error_message%>
|
||||
alert("<%= @project_error_message%>");
|
||||
<% else%>
|
||||
$('#pro_st_tbc_03').html('<%= escape_javascript(render :partial => 'projects/settings/new_members') %>');
|
||||
hideOnLoad();
|
||||
alert("添加成功");
|
||||
<% end%>
|
||||
<%elsif @course%>
|
||||
<% if @create_member_error_messages%>
|
||||
alert("<%= @create_member_error_messages%>");
|
||||
|
@ -22,6 +13,5 @@ $('#tab-content-members').html('<%= escape_javascript(render :partial => 'projec
|
|||
$('#tbc_02').html('<%= escape_javascript(render :partial => 'courses/course_members') %>');
|
||||
alert("添加成功");
|
||||
<% end%>
|
||||
hideOnLoad();
|
||||
<%end%>
|
||||
|
||||
hideOnLoad();
|
||||
|
|
|
@ -90,7 +90,6 @@
|
|||
<p class="c_blue fb mt10 mb5"><%= l(:label_member_new) %></p>
|
||||
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
||||
<div class="member_search">
|
||||
<input hidden="hidden" value="true" name="flag">
|
||||
<input id="principal_search" class="member_search_input fl" type="text" placeholder="请输入用户名称来搜索好友">
|
||||
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
|
||||
<div class="cl"></div>
|
||||
|
|
Loading…
Reference in New Issue