Files
nairobi/app/components/layout/common_html_attributes_component.rb
Javi Martín 5c61b72d21 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.
2022-11-11 01:39:29 +01:00

22 lines
419 B
Ruby

class Layout::CommonHTMLAttributesComponent < ApplicationComponent
delegate :rtl?, to: :helpers
private
def attributes
sanitize([dir, lang, html_class].compact.join(" "))
end
def dir
'dir="rtl"' if rtl?
end
def lang
"lang=\"#{I18n.locale}\""
end
def html_class
"class=\"tenant-#{Tenant.current_schema}\"" if Rails.application.config.multitenancy
end
end