老师配置课程时成员列表显示异常

This commit is contained in:
sw 2014-11-24 15:03:34 +08:00
parent adf75d2e8a
commit f1aca94a30
1 changed files with 38 additions and 13 deletions

View File

@ -20,8 +20,10 @@
<% members.each do |member| %>
<% next if member.new_record? %>
<tr id="member-<%= member.id %>" class="<%= cycle 'odd', 'even' %> member">
<td class="<%= member.principal.class.name.downcase %>" style="text-align: center"><%= link_to_user member.principal %></td>
<td class="roles" style="text-align: center">
<td class="<%= member.principal.class.name.downcase %>">
<%= link_to_user member.principal %>
</td>
<td class="roles">
<span id="member-<%= member.id %>-roles">
<%= h member.roles.sort.collect(&:to_s).join(', ') %>
</span>
@ -31,9 +33,14 @@
) do |f| %>
<p>
<% roles.each do |role| %>
<label><%= 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? } %> <%= h role %></label><br/>
<% end %></p>
<label>
<%= 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? } %>
<%= h role %>
</label>
<br/>
<% end %>
</p>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<p><%= submit_tag l(:button_change), :class => "small" %>
<%= link_to_function l(:button_cancel),
@ -43,7 +50,9 @@
</td>
<!--modified by huang for: if the user'roles is Manager that he will can't modified himself-->
<% if member.roles.first.to_s == "Manager" %>
<td class="buttons"></td>
<td class="buttons">
</td>
<% else %>
<td class="buttons">
<%= link_to_function l(:button_edit),
@ -61,7 +70,9 @@
</tbody>
</table>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<p class="nodata">
<%= l(:label_no_data) %>
</p>
<% end %>
</div>
@ -69,9 +80,14 @@
<% if roles.any? %>
<%= form_for(@member, {:as => :membership, :url => course_memberships_path(@course), :remote => true, :method => :post}) do |f| %>
<fieldset>
<legend><%= l(:label_member_new) %></legend>
<legend>
<%= l(:label_member_new) %>
</legend>
<p><%= label_tag "principal_search", l(:label_principal_search) %><%= text_field_tag 'principal_search', nil %></p>
<p>
<%= label_tag "principal_search", l(:label_principal_search) %>
<%= text_field_tag 'principal_search', nil %>
</p>
<%= javascript_tag "observeSearchfield('principal_search', null, '#{ escape_javascript autocomplete_course_memberships_path(@course, :format => 'js') }')" %>
<div id="principals_for_new_member">
@ -83,13 +99,22 @@
<% roles.each do |role| %>
<% if role.id == 10 %> <!-- 默认学生角色 -->
<label><%= radio_button_tag 'membership[role_ids][]', role.id, true %> <%= h role %></label>
<label>
<%= radio_button_tag 'membership[role_ids][]', role.id, true %>
<%= h role %>
</label>
<% else %>
<label><%= radio_button_tag 'membership[role_ids][]', role.id %> <%= h role %></label>
<label>
<%= radio_button_tag 'membership[role_ids][]', role.id %>
<%= h role %>
</label>
<% end %>
<% end %></p>
<% end %>
</p>
<p><%= submit_tag l(:button_add), :id => 'member-add-submit' %></p>
<p>
<%= submit_tag l(:button_add), :id => 'member-add-submit' %>
</p>
</fieldset>
<% end %>
<% end %>