diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index bf3bb7a3a..cc34d9fea 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -1,9 +1,9 @@ class ExaminationBanksController < ApplicationController include PaginateHelper before_action :require_login - before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public, :revoke_item] - before_action :find_exam, except: [:index, :create] - before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item] + before_action :certi_identity_auth, only: [:create, :edit, :update, :destroy, :set_public, :revoke_item, :cancel_items] + before_action :find_exam, except: [:index, :create, :cancel_items] + before_action :edit_auth, only: [:update, :destroy, :set_public, :revoke_item, :cancel_items] before_action :identity_auth, only: [:index] def index @@ -76,6 +76,11 @@ class ExaminationBanksController < ApplicationController render_ok end + def cancel_items + current_user.item_baskets.where(item_bank_id: params[:item_ids]).destroy_all + render_ok + end + private def form_params diff --git a/config/routes.rb b/config/routes.rb index e2b8f33a6..2bbdd6c3c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -85,6 +85,7 @@ Rails.application.routes.draw do post :set_public delete :revoke_item end + post :cancel_items, on: :collection end resources :examination_items do