已发布的实训路径增加“撤销发布”功能

This commit is contained in:
cxt 2017-09-30 16:30:49 +08:00
parent 1b5b77b6c5
commit d38a301ca8
3 changed files with 8 additions and 0 deletions

View File

@ -129,6 +129,11 @@ class SubjectsController < ApplicationController
redirect_to subject_path(@subject)
end
def cancel_has_publish
@subject.update_attributes(:status => 0)
redirect_to subject_path(@subject)
end
def destroy
if @subject
ApplyAction.where(:container_type => "ApplySubject", :container_id => @subject.id).destroy_all

View File

@ -41,6 +41,8 @@
<%= link_to '申请发布', publish_subject_path(@subject), :class => "course-btn fr", :remote => true %>
<% elsif @subject.status == 1 && User.current.manager_of_subject?(@subject) %>
<%= link_to '撤销申请', cancel_publish_subject_path(@subject), :class => "course-btn fr" %>
<% elsif @subject.status == 2 && User.current.manager_of_subject?(@subject) %>
<a href="javascript:void(0)" class="course-btn fr" onclick="s_op_confirm_box('<%= cancel_has_publish_subject_path(@subject) %>', '是否确认撤销发布<br/>确认后,回退到编辑状态')">撤销发布</a>
<% end %>
</div>
</div>

View File

@ -44,6 +44,7 @@ RedmineApp::Application.routes.draw do
get 'choose_subject_shixun'
get 'publish'
get 'cancel_publish'
get 'cancel_has_publish'
post 'update_attr'
end