mirror of https://github.com/tootsuite/mastodon
Add direction tags to HTML e-mails for RTL languages (#6373)
parent
106efba800
commit
79bc3d5845
|
@ -22,10 +22,18 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_rtl_body_class(other_classes)
|
def add_rtl_body_class(other_classes)
|
||||||
other_classes = "#{other_classes} rtl" if [:ar, :fa, :he].include?(I18n.locale)
|
other_classes = "#{other_classes} rtl" if locale_direction == 'rtl'
|
||||||
other_classes
|
other_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def locale_direction
|
||||||
|
if [:ar, :fa, :he].include?(I18n.locale)
|
||||||
|
'rtl'
|
||||||
|
else
|
||||||
|
'ltr'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def favicon_path
|
def favicon_path
|
||||||
env_suffix = Rails.env.production? ? '' : '-dev'
|
env_suffix = Rails.env.production? ? '' : '-dev'
|
||||||
"/favicon#{env_suffix}.ico"
|
"/favicon#{env_suffix}.ico"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
||||||
|
helper :application
|
||||||
helper :instance
|
helper :instance
|
||||||
helper :mailer
|
helper :mailer
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
class UserMailer < Devise::Mailer
|
class UserMailer < Devise::Mailer
|
||||||
layout 'mailer'
|
layout 'mailer'
|
||||||
|
|
||||||
|
helper :application
|
||||||
helper :instance
|
helper :instance
|
||||||
|
|
||||||
add_template_helper RoutingHelper
|
add_template_helper RoutingHelper
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
%title/
|
%title/
|
||||||
|
|
||||||
= stylesheet_pack_tag 'mailer'
|
= stylesheet_pack_tag 'mailer'
|
||||||
%body
|
%body{ dir: locale_direction }
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- i ||= 0
|
- i ||= 0
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0, dir: 'ltr' }
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td.email-body
|
%td.email-body
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
%bdi= display_name(status.account)
|
%bdi= display_name(status.account)
|
||||||
= "@#{status.account.acct}"
|
= "@#{status.account.acct}"
|
||||||
|
|
||||||
= Formatter.instance.format(status)
|
%div{ dir: rtl_status?(status) ? 'rtl' : 'ltr' }
|
||||||
|
= Formatter.instance.format(status)
|
||||||
|
|
||||||
%p.status-footer
|
%p.status-footer
|
||||||
= link_to l(status.created_at), web_url("statuses/#{status.id}")
|
= link_to l(status.created_at), web_url("statuses/#{status.id}")
|
||||||
|
|
Loading…
Reference in New Issue