Identify the current tenant in the <html> tag

This way it will be possible to write CSS and JavaScript code that will
only apply to specific tenants.

Note that CSS customization is still limited because it isn't possible
to use different SCSS variables per tenant.
This commit is contained in:
Javi Martín
2022-10-06 17:48:42 +02:00
parent 2c0ede3aaa
commit 5c61b72d21
3 changed files with 50 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ class Layout::CommonHTMLAttributesComponent < ApplicationComponent
private
def attributes
sanitize([dir, lang].compact.join(" "))
sanitize([dir, lang, html_class].compact.join(" "))
end
def dir
@@ -14,4 +14,8 @@ class Layout::CommonHTMLAttributesComponent < ApplicationComponent
def lang
"lang=\"#{I18n.locale}\""
end
def html_class
"class=\"tenant-#{Tenant.current_schema}\"" if Rails.application.config.multitenancy
end
end