教师团队的删除判断、“增加教师”链接跳转时展开添加成员
This commit is contained in:
parent
b49e29860d
commit
e1ce5d2305
|
@ -172,6 +172,7 @@ class SyllabusesController < ApplicationController
|
|||
|
||||
def members
|
||||
@members = @syllabus.syllabus_members.includes(:user => {:user_extensions => [], :courses => []}).order("rank asc")
|
||||
@show = params[:show] ? params[:show].to_i : 0
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html{render :layout => 'base_syllabus'}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<h3 class="sy_right_title">教师团队
|
||||
<% if User.current == @syllabus.user || User.current.admin? %>
|
||||
<a href="<%=members_syllabus_path(syllabus) %>" class="sy_cmore fr mr10" >增加教师</a>
|
||||
<a href="<%=members_syllabus_path(syllabus, :show => 1) %>" class="sy_cmore fr mr10">增加教师</a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</h3>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<tr>
|
||||
<th>序号</th>
|
||||
<th class="sy_new_namebox">姓名</th>
|
||||
<th>身份</th>
|
||||
<th>职业</th>
|
||||
<th>创建班级数</th>
|
||||
<th>参与班级数</th>
|
||||
<% if is_admin %>
|
||||
|
@ -15,6 +15,7 @@
|
|||
<tbody>
|
||||
<% @members.each_with_index do |member, i| %>
|
||||
<% user = member.user %>
|
||||
<% allow_delete = @syllabus.courses.where(:tea_id => member.user_id).empty? && i != 0 %>
|
||||
<tr>
|
||||
<td><%= member.rank %></td>
|
||||
<td>
|
||||
|
@ -36,16 +37,20 @@
|
|||
<td>
|
||||
<% if i == 0 %>
|
||||
|
||||
<% elsif i == 1 %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<% elsif i == @members.count - 1 %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% else %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% if allow_delete %>
|
||||
<%= link_to('删除', {:controller => 'syllabus_member', :action => 'destroy', :id => member.id, :syllabus => @syllabus.id},:remote => true, :method => 'delete', :confirm => l(:text_are_you_sure), :class => "fr sy_btn_grey mr5", :title => l(:button_delete)) %>
|
||||
<% else %>
|
||||
<a href="javascript:void(0)" class="fr sy_btn_grey mr5" title="该老师已在本课程下创建了班级,不能删除">删除</a>
|
||||
<% end %>
|
||||
<% if i == 1 %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<% elsif i == @members.count - 1 %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% else %>
|
||||
<%= link_to('下移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'down'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '下移') %>
|
||||
<%= link_to('上移', {:controller => 'syllabus_member', :action => 'update_rank', :id => member.id, :syllabus => @syllabus.id, :opr => 'up'},:remote => true, :method => 'post', :class => "fr sy_btn_blue mr5", :title => '上移') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<%= render :partial => 'syllabus_member_list' %>
|
||||
<a href="javascript:void(0);" class="fl sy_btn_green" onclick="toggle_search();">添加成员</a>
|
||||
</div>
|
||||
<div class="sy_new_tchbox clear undis" id="sy_search_box">
|
||||
<div class="sy_new_tchbox clear <%= @show == 1 ? '' : 'undis' %>" id="sy_search_box">
|
||||
<%= form_tag url_for(:controller => 'syllabus_member', :action => 'create', :syllabus => @syllabus),:id => 'syllabus_member_add_form', :remote => true do |f|%>
|
||||
<input hidden="hidden" value="true" name="flag">
|
||||
<div class="hw_search_box mb10">
|
||||
|
|
Loading…
Reference in New Issue