diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 45575406f..528109a28 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -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 diff --git a/app/views/subjects/_subject_top.html.erb b/app/views/subjects/_subject_top.html.erb index ce033d81c..3622c68dc 100644 --- a/app/views/subjects/_subject_top.html.erb +++ b/app/views/subjects/_subject_top.html.erb @@ -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) %> + 撤销发布 <% end %> diff --git a/config/routes.rb b/config/routes.rb index e659931c4..09410cc58 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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