开启重启课程在课程列表里

This commit is contained in:
yanxd 2014-04-21 08:39:49 +08:00
parent 8775eab3dd
commit 9034dd09e7
3 changed files with 7 additions and 4 deletions

View File

@ -1,8 +1,9 @@
<%
id = "finish_course_tag"
id = "finish_course_#{project.id}"
display = (project.course_extra.teacher.id == User.current.id )
%>
<% if course_endTime_timeout?(project) #如果课程已结束%>
<% if display && course_endTime_timeout?(project) #如果课程已结束%>
<%= link_to '重启课程', restartcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要重启课程?') %>
<% else %>
<%= link_to '关闭课程', finishcourse_project_path(project), :remote => true, :method => :post, :id => id, :confirm => ('确定要关闭课程?') %>

View File

@ -2,7 +2,7 @@
<% if Rails.env.development? %>
console.debug('课程修改成功:结束时间改为<%=Course.find_by_extra(@project.identifier).try(:endup_time)%>');
<% end %>
$('#finish_course_tag').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:project => @project} )%>")
$('#finish_course_<%=@project.id%>').replaceWith("<%= j(render partial: 'courses/set_course_time', :locals => {:project => @project} )%>")
<% else %>
alert('设置失败,请在论坛提交问题,等待管理员处理。');
<% end %>

View File

@ -8,9 +8,11 @@
<td>
<table width="580" border="0">
<tr>
<td colspan="2" valign="top"><span><%= link_to_project(membership.project) %></span>
<td colspan="2" valign="top">
<span><%= link_to_project(membership.project) %></span>
<!--added by huang for: filter by roles-->
<span style="float: right">
<%=render :partial => 'courses/set_course_time', :locals => {:project => membership.project} %>
<% if User.current == @user %>
<% (membership.roles).each do |role| %>
<% unless (role == Role.find(9) || role == Role.find(3)) %>