diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb index 9a4a25013..0451b77d1 100644 --- a/app/controllers/admins/base_controller.rb +++ b/app/controllers/admins/base_controller.rb @@ -6,7 +6,6 @@ class Admins::BaseController < ApplicationController layout 'admin' skip_before_action :verify_authenticity_token - before_action :require_login, :require_admin! after_action :rebind_event_if_ajax_render_partial diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ac53343b5..f336205cd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -282,10 +282,10 @@ class ApplicationController < ActionController::Base end def user_setup - # reacct静态资源加载不需要走这一步 + # # reacct静态资源加载不需要走这一步 return if params[:controller] == "main" # Find the current user - Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}") + #Rails.logger.info("current_laboratory is #{current_laboratory} domain is #{request.subdomain}") User.current = find_current_user uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) diff --git a/app/controllers/cooperative/base_controller.rb b/app/controllers/cooperative/base_controller.rb index dfc99b7b8..5d21598aa 100644 --- a/app/controllers/cooperative/base_controller.rb +++ b/app/controllers/cooperative/base_controller.rb @@ -10,6 +10,7 @@ class Cooperative::BaseController < ApplicationController before_action :laboratory_exist!, :require_login, :require_cooperative_manager! after_action :rebind_event_if_ajax_render_partial + skip_before_action :check_sign helper_method :current_laboratory, :current_setting_or_default diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index e5ca0dc1d..3eaac0648 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -44,12 +44,13 @@ class HacksController < ApplicationController begin logger.info("##########{hack_params}") hack = Hack.new(hack_params) + hack.user_id = current_user.id + hack.identifier = generate_identifier Hack, 8 ActiveRecord::Base.transaction do - hack.user_id = current_user.id - hack.identifier = generate_identifier Hack, 8 hack.save! # 创建测试集与代码 hack.hack_sets.create!(hack_sets_params) + # 新建知识点 hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save! diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index dc9f6c091..ae0315cdd 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -15,7 +15,6 @@ class SchoolsController < ApplicationController schools = School.all keyword = params[:keyword].to_s.strip schools = schools.where('name LIKE ?', "%#{keyword}%") if keyword - render_ok(schools: schools.select(:id, :name).as_json) end diff --git a/app/views/admins/shared/_sidebar.html.erb b/app/views/admins/shared/_sidebar.html.erb index 4b84068e7..09c115b06 100644 --- a/app/views/admins/shared/_sidebar.html.erb +++ b/app/views/admins/shared/_sidebar.html.erb @@ -2,7 +2,7 @@