Use the dir attribute in dashboard and mailer layouts
We forgot to do so in commit d827768c0. In order to avoid the same
mistake in the future, we're extracting a method to get these
attributes. We're also adding tests, since we didn't have any tests to
check that the `dir` attribute was properly set.
This commit is contained in:
17
app/components/layout/common_html_attributes_component.rb
Normal file
17
app/components/layout/common_html_attributes_component.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
class Layout::CommonHTMLAttributesComponent < ApplicationComponent
|
||||
delegate :rtl?, to: :helpers
|
||||
|
||||
private
|
||||
|
||||
def attributes
|
||||
sanitize([dir, lang].compact.join(" "))
|
||||
end
|
||||
|
||||
def dir
|
||||
'dir="rtl"' if rtl?
|
||||
end
|
||||
|
||||
def lang
|
||||
"lang=\"#{I18n.locale}\""
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user