From f8f6844ec3da9530fd88096ca8ba5fd2a3c4fd42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 6 Apr 2024 21:05:50 +0200 Subject: [PATCH] Simplify common HTML attributes using tag.attributes The `tag.attributes` method was introduced in Rails 7.0. --- app/components/layout/common_html_attributes_component.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/components/layout/common_html_attributes_component.rb b/app/components/layout/common_html_attributes_component.rb index 63f35e0f6..c79881ba6 100644 --- a/app/components/layout/common_html_attributes_component.rb +++ b/app/components/layout/common_html_attributes_component.rb @@ -4,18 +4,18 @@ class Layout::CommonHtmlAttributesComponent < ApplicationComponent private def attributes - sanitize([dir, lang, html_class].compact.join(" ")) + tag.attributes(dir: dir, lang: lang, class: html_class) end def dir - 'dir="rtl"' if rtl? + "rtl" if rtl? end def lang - "lang=\"#{I18n.locale}\"" + I18n.locale end def html_class - "class=\"tenant-#{Tenant.current_schema}\"" if Rails.application.config.multitenancy + "tenant-#{Tenant.current_schema}" if Rails.application.config.multitenancy end end