现在版-在线课堂的实训作业子目录增加删除功能-本周上线

dev_SaaS
cxt 6 years ago
parent 39c6daf466
commit 49a794f11a

@ -1533,6 +1533,16 @@ class CoursesController < ApplicationController
end
end
# 删除实训作业子目录
def delete_homework_category
category = @course.course_homework_categories.where(:id => params[:category_id]).first
if category.present?
category.homework_commons.update_all(:course_homework_category_id => nil)
category.destroy
end
redirect_to homework_common_index_path(:course => @course.id, :homework_type => 4)
end
def toggleCourse
@course_prefs = Course.find_by_extra(@course.extra)
unless (User.current.allowed_to?(:as_teacher,@course_prefs) || User.current.admin?)

@ -1,5 +1,5 @@
class CourseHomeworkCategory < ActiveRecord::Base
belongs_to :course
has_many :shixun_homework_categories
has_many :homework_commons
attr_accessible :name
end

@ -11,6 +11,7 @@
<%= link_to '选用实训', shixuns_homework_common_index_path(:course => @course.id, :category_id => @category.try(:id)), :remote => true, :class => "white-btn edu-orangeback-btn fr mr20 mt2", :title => "新建作业" %>
<% if @category.present? %>
<a href="<%= rename_homework_category_course_path(@course, :category_id => @category.id) %>" data-remote="true" class="white-btn edu-orangeline-btn mr10 fr mt2">子栏目重命名</a>
<a href="javascript:void(0);" class="white-btn edu-greyshallowline-btn mr10 mt2 fr" onclick="delete_confirm_box_3('<%= delete_homework_category_course_path(@course, :category_id => @category.id) %>', '该子目录下的作业将被移动到父目录中<br/>确定要删除吗?')">删除子目录</a>
<% else %>
<a href="javascript:void(0)" class="white-btn edu-orangeline-btn mr10 fr mt2" onclick="addSubColumn();">添加子栏目</a>
<% end %>

@ -2393,6 +2393,7 @@ RedmineApp::Application.routes.draw do
post 'assign_teacher_groups'
post 'create_homework_category'
match 'rename_homework_category', :via => [:get, :post]
delete 'delete_homework_category'
post 'import_course_group'
end
collection do

Loading…
Cancel
Save