2014-03-17 22:43:38 +08:00
|
|
|
<%
|
2014-06-04 16:58:26 +08:00
|
|
|
id = "finish_course_#{course.id}"
|
|
|
|
display = (course.teacher.id == User.current.id || User.current.admin?)
|
2014-03-17 22:43:38 +08:00
|
|
|
%>
|
|
|
|
|
2014-05-06 09:26:48 +08:00
|
|
|
<% if display #如果课程已结束%>
|
2014-06-04 16:58:26 +08:00
|
|
|
<% linkPath = course_endTime_timeout?(course) ? restartcourse_course_path(course) : finishcourse_course_path(course, format: :js) %>
|
|
|
|
<% desc = course_endTime_timeout?(course) ? '重启' : '关闭' %>
|
2014-05-06 09:26:48 +08:00
|
|
|
|
2014-11-04 17:48:18 +08:00
|
|
|
<%= link_to "#{desc}", linkPath, :remote => true, :method => :post, :id => id, :confirm => ("确定要#{desc}课程?") %>
|
2014-03-17 22:43:38 +08:00
|
|
|
<% else %>
|
2014-05-06 09:26:48 +08:00
|
|
|
<!-- 关闭课程block -->
|
2014-03-17 22:43:38 +08:00
|
|
|
<% end %>
|