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.
32 lines
825 B
32 lines
825 B
module LaboratoryHelper
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
before_action :setup_laboratory
|
|
|
|
helper_method :current_laboratory
|
|
helper_method :default_setting
|
|
helper_method :default_yun_session
|
|
end
|
|
|
|
def current_laboratory
|
|
@_current_laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
|
end
|
|
|
|
def default_laboratory
|
|
@_default_laboratory ||= Laboratory.find(1)
|
|
end
|
|
|
|
def default_setting
|
|
@_default_setting ||= LaboratorySetting.find_by(laboratory_id: 1)
|
|
end
|
|
|
|
def setup_laboratory
|
|
Laboratory.current = current_laboratory
|
|
end
|
|
|
|
def default_yun_session
|
|
laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
|
|
@_default_yun_session = "#{laboratory.try(:identifier).split('.').first}_user_id"
|
|
end
|
|
end |