2015-03-30 11:20:16 +08:00
|
|
|
|
<% @members.each do |member| %>
|
|
|
|
|
<li >
|
2015-12-10 20:03:59 +08:00
|
|
|
|
<%#= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
|
2016-07-07 17:34:38 +08:00
|
|
|
|
<%= link_to "#{member.principal}(#{member.principal.show_name})", user_path(member.principal), :class => "w150 linkBlue fl", :style=>"white-space: nowrap;overflow: hidden;text-overflow: ellipsis;", :title => "#{member.principal}(#{member.principal.show_name})" %>
|
2015-03-30 11:20:16 +08:00
|
|
|
|
<span class="w150 fl">
|
2015-05-08 09:37:57 +08:00
|
|
|
|
<%= zh_course_role(h member.roles.sort.collect(&:to_s).join(', ')) %>
|
2015-03-30 15:57:10 +08:00
|
|
|
|
<%= 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-05-08 09:37:57 +08:00
|
|
|
|
<ul style="text-align: left;" class="ml45">
|
2016-07-29 14:34:42 +08:00
|
|
|
|
<%= check_box_tag 'membership[role_ids][]', role.id, member.roles.include?(role), :id => "edit_member_role_#{member.id}_#{role.id}",
|
2015-03-30 15:57:10 +08:00
|
|
|
|
:disabled => member.member_roles.detect { |mr| mr.role_id == role.id && !mr.inherited_from.nil? } %>
|
2015-05-08 09:37:57 +08:00
|
|
|
|
<label ><%= zh_course_role(h role) %></label>
|
2015-03-30 15:57:10 +08:00
|
|
|
|
</ul>
|
|
|
|
|
<!--<br/>-->
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= hidden_field_tag 'membership[role_ids][]', '' %>
|
2015-05-08 09:37:57 +08:00
|
|
|
|
<div class="ml45">
|
2015-03-30 15:57:10 +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>
|
|
|
|
|
<% unless member.roles.first.to_s == "Manager"%>
|
|
|
|
|
<a href="javascript:void(0) " class="c_dblue w40 fl" onclick="$('#member-<%= member.id%>-roles-form').show();$(this).parent().height(110);">编辑</a>
|
|
|
|
|
<%= delete_link membership_path(member),
|
|
|
|
|
:remote => true,
|
|
|
|
|
:class => "c_dblue w40 fl",
|
|
|
|
|
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_delete_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
|
|
|
|
|
<% end%>
|
2015-03-30 11:20:16 +08:00
|
|
|
|
</li>
|
2016-07-29 14:34:42 +08:00
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
$(function() {
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_7").on('click', function(){
|
|
|
|
|
if($("#edit_member_role_<%=member.id %>_7").is(":checked")) {
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_9").attr("checked",false);
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_9").attr('disabled', 'disabled');
|
|
|
|
|
} else {
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_9").removeAttr('disabled');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_9").on('click', function(){
|
|
|
|
|
if($("#edit_member_role_<%=member.id %>_9").is(":checked")) {
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_7").attr('disabled', 'disabled');
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_7").attr("checked",false);
|
|
|
|
|
} else {
|
|
|
|
|
$("#edit_member_role_<%=member.id %>_7").removeAttr('disabled');
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
<% end%>
|