You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/controllers/ecs/ec_training_objectives_cont...

26 lines
724 B

class Ecs::EcTrainingObjectivesController < Ecs::BaseController
before_action :check_major_manager_permission!, only: [:create]
def show
@training_objective = current_year.ec_training_objective
respond_to do |format|
format.json
format.xlsx do
filename = "#{@training_objective.ec_year.year}届培养目标_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
render xlsx: 'show', filename: filename
end
end
end
def create
@training_objective = Ecs::CreateTrainingObjectiveService.call(current_year, create_params)
render 'show'
end
private
def create_params
params.permit(:content, training_subitems: [:id, :content])
end
end