%= error_messages_for 'member' %>
<%
roles = Role.givable.all
if @project.project_type == Project::ProjectType_course
if User.current.language == "zh"
roles = ["管理人员","开发者","报告人员"]
else
roles = ["管理人员","开发者","报告人员"]
# roles = roles[3..5]
end
else
roles = roles[0..2]
end
members = @project.member_principals.includes(:roles, :principal).all.sort
%>
<% if members.any? %>
- <%= l(:label_user) %><%= l(:label_role_plural) %>
<%= call_hook(:view_projects_settings_members_table_header, :project => @project) %>
<% members.each do |member| %>
-
<%= link_to_user_header member.principal, true, :class => "w140_h c_setting_blue fl" %>
<% if User.current.language == "zh" %>
<% zh_roles = [] %>
<% member.roles.each do |role| %>
<% if role.id == 3
zh_roles << "管理人员"
elsif role.id == 4
zh_roles << "开发人员"
else
zh_roles << "报告人员"
end
%>
<% end %>
<%= h zh_roles.sort.reverse.collect(&:to_s).join(', ') %>
<% else %>
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<% end %>
<%= 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| %>
<%= radio_button_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? } %>
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<% elsif role.id == 4 %>
<% else %>
<% end %>
<% else %>
<% end %>
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<% end %>
<% unless member.user_id == @project.user_id %>
编辑
<%= delete_link membership_path(member),
:remote => true,
:class => "c_setting_blue ml15 fl",
:data => (!User.current.admin? && member.include?(User.current) ? {:confirm => l(:text_own_membership_for_project_confirmation)} : {confirm: l(:label_delete_confirm)}) if member.deletable? %>
<% end%>
<% end%>
<% else %>
<%= l(:label_no_data) %>
<% end %>
<% if roles.any? %>
<%= l(:label_member_new) %>
<%= form_for(@member, {:as => :membership, :url => project_memberships_path(@project), :remote => true, :method => :post}) do |f| %>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_project_memberships_path(@project, :format => 'js') }')" %>
<%= render_project_members(@project) %>
-
<%= l(:label_role_plural) %>:
<% roles.each do |role| %>
-
<%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "报告人员" || role.name == "Reporter" %>
<% if User.current.language == "zh" %>
<% if role.id == 3 %>
<% elsif role.id == 4 %>
<% else %>
<% end %>
<% else %>
<% end %>
<% end %>
新增成员
<% end%>
<% end %>