From 78336dfe5bb83fc279b68092d7d33e988f4d8c8d Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 15 Nov 2019 11:47:13 +0800 Subject: [PATCH] laboratory: fix --- app/controllers/admins/base_controller.rb | 6 +++++- app/views/settings/show.json.jbuilder | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb index ad56afbf7..f90c8a1ed 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 - skip_before_action :setup_laboratory before_action :require_login, :require_admin! @@ -38,4 +37,9 @@ class Admins::BaseController < ApplicationController append_js = ERB.new(File.open(path).read).result response.body += append_js end + + # 重写此方法,防止影响超级管理员端云上实验室功能,因为那里重写了:current_laboratory方法 + def setup_laboratory + Laboratory.current = Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1) + end end \ No newline at end of file diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index a43544b23..e21e9fa48 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -14,4 +14,6 @@ json.setting do json.navbar setting.navbar || default_setting.navbar json.footer setting.footer || default_setting.footer + + json.main_site current_laboratory.main_site? end \ No newline at end of file