课程配置页面,角色改为中文

This commit is contained in:
sw 2015-05-08 09:37:57 +08:00
parent cfe3021391
commit 2749c4f890
3 changed files with 18 additions and 5 deletions

View File

@ -797,4 +797,17 @@ module CoursesHelper
end
result
end
def zh_course_role role
if role == "TeachingAsistant"
result = l(:label_TA)
elsif role == "Teacher"
result = l(:label_teacher)
elsif role == "Student"
result = l(:label_student)
elsif role == "Manager"
result = l(:field_admin)
end
result
end
end

View File

@ -37,7 +37,7 @@
<% @roles.each do |role| %>
<li>
<%= radio_button_tag 'membership[role_ids][]', role.id, role.name == "学生" || role.name == "Student" %>
<label ><%= h role %></label>
<label ><%= zh_course_role(h role) %></label>
</li>
<% end %>
</ul>

View File

@ -2,21 +2,21 @@
<li >
<%= link_to_user_header member.principal,true,:class => "w150 c_orange fl" %>
<span class="w150 fl">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
<%= zh_course_role(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| %>
<ul style="text-align: left;" class="ml20">
<ul style="text-align: left;" class="ml45">
<%= 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? } %>
<label ><%= h role %></label>
<label ><%= zh_course_role(h role) %></label>
</ul>
<!--<br/>-->
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="ml20">
<div class="ml45">
<a href="javascript:void(0)" class="member_btn" onclick="$('#member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%>
</a>