diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 775afadbc29..16401e1f296 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -32,7 +32,7 @@ module ApplicationHelper end def html_classes - "#{mobile_view? ? 'mobile-view' : 'desktop-view'} #{mobile_device? ? 'mobile-device' : 'not-mobile-device'} #{RTL.html_class}" + "#{mobile_view? ? 'mobile-view' : 'desktop-view'} #{mobile_device? ? 'mobile-device' : 'not-mobile-device'} #{rtl_view? ? 'rtl' : ''}" end def escape_unicode(javascript) @@ -124,6 +124,21 @@ module ApplicationHelper MobileDetection.mobile_device?(request.user_agent) end + def rtl_view? + site_default_rtl? || current_user_rtl? + end + + def current_user_rtl? + SiteSetting.allow_user_locale && current_user.try(:locale).in?(rtl_locales) + end + + def site_default_rtl? + !SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(rtl_locales) + end + + def rtl_locales + %w(he ar) + end def customization_disabled? controller.class.name.split("::").first == "Admin" || session[:disable_customization] diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index dec6fe7b1cf..6ada3e2e4dd 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -198,7 +198,7 @@ class UserNotifications < ActionMailer::Base html = UserNotificationRenderer.new(Rails.configuration.paths["app/views"]).render( template: 'email/notification', format: :html, - locals: { context_posts: context_posts, post: post, top: top ? PrettyText.cook(top).html_safe : nil, classes: RTL.html_class } + locals: { context_posts: context_posts, post: post, top: top ? PrettyText.cook(top).html_safe : nil } ) template = "user_notifications.user_#{notification_type}" diff --git a/app/models/rtl.rb b/app/models/rtl.rb deleted file mode 100644 index 4fed8c9178f..00000000000 --- a/app/models/rtl.rb +++ /dev/null @@ -1,23 +0,0 @@ -class RTL - - def self.enabled? - site_locale_rtl? || current_user_rtl? - end - - def self.current_user_rtl? - SiteSetting.allow_user_locale && current_user.try(:locale).in?(rtl_locales) - end - - def self.site_locale_rtl? - !SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(rtl_locales) - end - - def self.rtl_locales - %w(he ar) - end - - def self.html_class - enabled? ? 'rtl' : '' - end - -end diff --git a/app/views/email/notification.html.erb b/app/views/email/notification.html.erb index 363f2ae46d4..8108cc693f6 100644 --- a/app/views/email/notification.html.erb +++ b/app/views/email/notification.html.erb @@ -1,4 +1,4 @@ -
> +
<% if top.present? %>
<%= top %>
diff --git a/lib/email/styles.rb b/lib/email/styles.rb index c6428ffca72..84e602f5f87 100644 --- a/lib/email/styles.rb +++ b/lib/email/styles.rb @@ -53,7 +53,6 @@ module Email style('.user-avatar', 'vertical-align:top;width:55px;') style('.user-avatar img', nil, width: '45', height: '45') style('hr', 'background-color: #ddd; height: 1px; border: 1px;') - style('.rtl', 'direction: rtl;') # we can do this but it does not look right # style('#main', 'font-family:"Helvetica Neue", Helvetica, Arial, sans-serif') style('td.body', 'padding-top:5px;', colspan: "2")