2015-04-14 10:23:49 +08:00
|
|
|
|
<%= error_messages_for 'member' %>
|
|
|
|
|
<%
|
|
|
|
|
roles = Role.givable.all
|
|
|
|
|
if @project.project_type == Project::ProjectType_course
|
|
|
|
|
roles = roles[3..5]
|
|
|
|
|
else
|
|
|
|
|
roles = roles[0..2]
|
|
|
|
|
end
|
|
|
|
|
members = @project.member_principals.includes(:roles, :principal).all.sort
|
|
|
|
|
%>
|
|
|
|
|
|
2015-04-11 16:17:36 +08:00
|
|
|
|
<div class="members_left">
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<% if members.any? %>
|
2015-04-14 11:47:47 +08:00
|
|
|
|
<ul style=" border-bottom:none;">
|
|
|
|
|
<li><span class="w90 f_b" ><%= l(:label_user) %></span><span class="w210 f_b"><%= l(:label_role_plural) %></span><span></span></li>
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
|
|
|
|
|
<% members.each do |member| %>
|
2015-04-14 11:47:47 +08:00
|
|
|
|
<li >
|
2015-04-16 19:08:16 +08:00
|
|
|
|
<%= link_to_user_header member.principal,false,:class => "w90 c_orange fl" %>
|
|
|
|
|
<span class="w210 fl">
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
|
|
|
|
|
<%= form_for(member, {:as => :membership, :remote => true, :url => membership_path(member),
|
|
|
|
|
:method => :put,
|
|
|
|
|
:html => {:id => "member-#{member.id}-roles-form", :class => 'hol'}}
|
|
|
|
|
) do |f| %>
|
|
|
|
|
<% roles.each do |role| %>
|
2015-04-16 19:08:16 +08:00
|
|
|
|
<ul style="text-align: left;" class="m115">
|
2015-04-14 11:47:47 +08:00
|
|
|
|
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role),
|
|
|
|
|
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<label ><%= h role %></label>
|
|
|
|
|
</ul>
|
|
|
|
|
<!--<br/>-->
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
2015-04-16 19:08:16 +08:00
|
|
|
|
<div class="m130">
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
|
|
|
|
|
<%= l(:button_change)%>
|
|
|
|
|
</a>
|
|
|
|
|
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').hide();$(this).parent().parent().parent().parent().height(30)">
|
|
|
|
|
<%= l(:button_cancel)%>
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</span>
|
2015-04-14 16:03:47 +08:00
|
|
|
|
<% unless member.user_id == @project.user_id %>
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<a href="javascript:void(0) " class="c_dblue ml15 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
|
|
|
|
|
<%= delete_link membership_path(member),
|
|
|
|
|
:remote => true,
|
|
|
|
|
:class => "c_dblue ml30 fl",
|
2015-04-14 19:34:01 +08:00
|
|
|
|
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_for_project_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
|
2015-04-14 16:03:47 +08:00
|
|
|
|
<% end%>
|
2015-04-14 10:23:49 +08:00
|
|
|
|
</li>
|
2015-04-14 11:47:47 +08:00
|
|
|
|
<% end%>
|
|
|
|
|
</ul>
|
2015-04-14 10:23:49 +08:00
|
|
|
|
<% else %>
|
|
|
|
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
|
|
|
|
<% end %>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
</div><!-- left -->
|
|
|
|
|
<!--right begin-->
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<% if roles.any? %>
|
2015-04-11 16:17:36 +08:00
|
|
|
|
<div class="members_right">
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<!-- applied -->
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<% if @project.applied_projects.any? %>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<div class="members_jion">
|
|
|
|
|
<p class="c_blue mb10 fb"><%= l(:label_apply_project) %></p>
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<%= form_for(@applied_members, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
|
|
|
|
|
<div id="principals_for_applied_member">
|
|
|
|
|
<%= render_principals_for_applied_members_new(@project) %>
|
|
|
|
|
</div>
|
|
|
|
|
<ul class="mb10">
|
|
|
|
|
<li><%= l(:label_role_plural) %>:</li>
|
|
|
|
|
<% roles.each do |role| %>
|
|
|
|
|
<li>
|
|
|
|
|
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
|
|
|
|
<label ><%= h role %></label >
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<a remote="true" href="javascript:void(0)" class="blue_btn fl" onclick="$('#new_membership').submit();">
|
|
|
|
|
<%= l(:label_approve) %>
|
|
|
|
|
</a>
|
|
|
|
|
<a remote="true" href="javascript:void(0)" class="grey_btn fl ml10" onclick="refusal_applied_member();">
|
|
|
|
|
<%= l(:label_refusal) %>
|
|
|
|
|
</a>
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<% end %>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %><!--members_jion end-->
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<div class="cl"></div>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<!-- add members -->
|
2015-04-14 11:47:47 +08:00
|
|
|
|
<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 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>
|
|
|
|
|
|
|
|
|
|
<div id="principals_for_new_member">
|
|
|
|
|
<%= render_principals_for_new_project_members(@project) %>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="cl"></div>
|
|
|
|
|
|
|
|
|
|
<ul class="rolebox mb10 mt10">
|
|
|
|
|
<li class="fb">
|
|
|
|
|
<%= l(:label_role_plural) %>:
|
|
|
|
|
</li>
|
|
|
|
|
<% roles.each do |role| %>
|
|
|
|
|
<li>
|
|
|
|
|
<%= check_box_tag 'membership[role_ids][]', role.id %>
|
|
|
|
|
<label ><%= h role %></label>
|
|
|
|
|
</li>
|
|
|
|
|
<% end %>
|
|
|
|
|
</ul>
|
|
|
|
|
<div class="cl mb10"></div>
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<a href="javascript:void(0)" class="member_btn" onclick="$(this).parent().parent().submit();">
|
2015-04-14 11:47:47 +08:00
|
|
|
|
新增成员
|
|
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
<% end%>
|
|
|
|
|
</div><!-- 右边 end-->
|
2015-04-14 15:34:04 +08:00
|
|
|
|
<% end %>
|
2015-04-11 16:17:36 +08:00
|
|
|
|
|
2015-04-14 19:34:01 +08:00
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
var collection=$("#principals_for_new_member").children("#principals").children("label");
|
|
|
|
|
collection.css("text-overflow","ellipsis");
|
|
|
|
|
collection.css("white-space","nowrap");
|
|
|
|
|
collection.css("width","200px");
|
|
|
|
|
collection.css("overflow","hidden");
|
|
|
|
|
for(i=0;i<collection.length;i++){ //增加悬浮显示
|
|
|
|
|
var label=collection[i];
|
|
|
|
|
var text=$(label).text();
|
|
|
|
|
$(label).attr("title",text);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|