|  |  |  | @ -26,14 +26,14 @@ class CoursesController < ApplicationController | 
			
		
	
		
			
				
					|  |  |  |  |                                      :base_info, :get_historical_courses, :create_group_by_importing_file, | 
			
		
	
		
			
				
					|  |  |  |  |                                      :attahcment_category_list,:export_member_scores_excel, :duplicate_course, | 
			
		
	
		
			
				
					|  |  |  |  |                                      :switch_to_teacher, :switch_to_assistant, :switch_to_student, :exit_course, | 
			
		
	
		
			
				
					|  |  |  |  |                                      :informs, :update_informs, :online_learning, :update_task_position, :tasks_list, :join_excellent_course] | 
			
		
	
		
			
				
					|  |  |  |  |                                      :informs, :update_informs, :new_informs, :online_learning, :update_task_position, :tasks_list, :join_excellent_course] | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :user_course_identity, except: [:join_excellent_course, :index, :create, :new, :apply_to_join_course, | 
			
		
	
		
			
				
					|  |  |  |  |                                                 :search_course_list, :get_historical_course_students, :mine, :search_slim, :board_list] | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :teacher_allowed, only: [:update, :destroy, :settings, :search_teacher_candidate, | 
			
		
	
		
			
				
					|  |  |  |  |                                          :transfer_to_course_group, :delete_from_course, | 
			
		
	
		
			
				
					|  |  |  |  |                                          :search_users, :add_students_by_search, :get_historical_courses, :add_teacher_popup, :add_teacher] | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :admin_allowed, only: [:set_invite_code_halt, :set_public_or_private, :change_course_admin, | 
			
		
	
		
			
				
					|  |  |  |  |                                        :set_course_group, :create_group_by_importing_file, :update_informs, | 
			
		
	
		
			
				
					|  |  |  |  |                                        :set_course_group, :create_group_by_importing_file, :update_informs, :new_informs, | 
			
		
	
		
			
				
					|  |  |  |  |                                        :update_task_position, :tasks_list] | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :teacher_or_admin_allowed, only: [:graduation_group_list, :create_graduation_group, :join_graduation_group, | 
			
		
	
		
			
				
					|  |  |  |  |                                                   :change_course_teacher, :export_member_scores_excel, :course_group_list, | 
			
		
	
	
		
			
				
					|  |  |  | @ -42,6 +42,7 @@ class CoursesController < ApplicationController | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :find_board, only: :board_list | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :validate_page_size, only: :mine | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :course_tasks, only: [:tasks_list, :update_task_position] | 
			
		
	
		
			
				
					|  |  |  |  |   before_action :validate_inform_params, only: [:update_informs, :new_informs] | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   if RUBY_PLATFORM =~ /linux/ | 
			
		
	
		
			
				
					|  |  |  |  |     require 'simple_xlsx_reader' | 
			
		
	
	
		
			
				
					|  |  |  | @ -159,7 +160,7 @@ class CoursesController < ApplicationController | 
			
		
	
		
			
				
					|  |  |  |  |               CourseMember.create!(course_id: @course.id, user_id: s_member.user_id, role: 2) | 
			
		
	
		
			
				
					|  |  |  |  |             end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             Inform.create(container: @course, description: @subject.learning_notes) | 
			
		
	
		
			
				
					|  |  |  |  |             Inform.create(container: @course, description: @subject.learning_notes, name: "学习须知") | 
			
		
	
		
			
				
					|  |  |  |  |           end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |           course_module_types = params[:course_module_types] | 
			
		
	
	
		
			
				
					|  |  |  | @ -234,14 +235,20 @@ class CoursesController < ApplicationController | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def informs | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @informs = @course.informs | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def update_informs | 
			
		
	
		
			
				
					|  |  |  |  |     tip_exception("公告内容不能为空") if params[:description].blank? | 
			
		
	
		
			
				
					|  |  |  |  |     inform = @course.inform || Inform.new(container: @course) | 
			
		
	
		
			
				
					|  |  |  |  |   def new_informs | 
			
		
	
		
			
				
					|  |  |  |  |     inform = Inform.new(container: @course) | 
			
		
	
		
			
				
					|  |  |  |  |     inform.name = params[:name] | 
			
		
	
		
			
				
					|  |  |  |  |     inform.description = params[:description] | 
			
		
	
		
			
				
					|  |  |  |  |     inform.save! | 
			
		
	
		
			
				
					|  |  |  |  |     normal_status("创建成功") | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def update_informs | 
			
		
	
		
			
				
					|  |  |  |  |     inform = @course.informs.find_by(id: params[:inform_id]) | 
			
		
	
		
			
				
					|  |  |  |  |     inform.update_attributes!(name: params[:name], description: params[:description]) | 
			
		
	
		
			
				
					|  |  |  |  |     normal_status("更新成功") | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -1259,6 +1266,11 @@ class CoursesController < ApplicationController | 
			
		
	
		
			
				
					|  |  |  |  |     end | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   def validate_inform_params | 
			
		
	
		
			
				
					|  |  |  |  |     tip_exception("公告标题不能为空") if params[:name].blank? | 
			
		
	
		
			
				
					|  |  |  |  |     tip_exception("公告内容不能为空") if params[:description].blank? | 
			
		
	
		
			
				
					|  |  |  |  |   end | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   # def find_container | 
			
		
	
		
			
				
					|  |  |  |  |   #   case params[:container_type] | 
			
		
	
		
			
				
					|  |  |  |  |   #   when 'shixun_homework', 'common_homework', 'group_homework' | 
			
		
	
	
		
			
				
					|  |  |  | 
 |