Class: Rtl
- Inherits:
-
Object
- Object
- Rtl
- Defined in:
- lib/rtl.rb
Constant Summary collapse
- LOCALES =
%w[ar fa_IR he ug ur]
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #css_class ⇒ Object
- #current_user_rtl? ⇒ Boolean
- #enabled? ⇒ Boolean
-
#initialize(user) ⇒ Rtl
constructor
A new instance of Rtl.
- #site_locale_rtl? ⇒ Boolean
Constructor Details
#initialize(user) ⇒ Rtl
Returns a new instance of Rtl.
8 9 10 |
# File 'lib/rtl.rb', line 8 def initialize(user) @user = user end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/rtl.rb', line 6 def user @user end |
Instance Method Details
#css_class ⇒ Object
24 25 26 |
# File 'lib/rtl.rb', line 24 def css_class enabled? ? "rtl" : "" end |
#current_user_rtl? ⇒ Boolean
16 17 18 |
# File 'lib/rtl.rb', line 16 def current_user_rtl? SiteSetting.allow_user_locale && (user&.locale || SiteSetting.default_locale).in?(LOCALES) end |
#enabled? ⇒ Boolean
12 13 14 |
# File 'lib/rtl.rb', line 12 def enabled? site_locale_rtl? || current_user_rtl? end |
#site_locale_rtl? ⇒ Boolean
20 21 22 |
# File 'lib/rtl.rb', line 20 def site_locale_rtl? !SiteSetting.allow_user_locale && SiteSetting.default_locale.in?(LOCALES) end |