summaryrefslogtreecommitdiff
path: root/app/models/page.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/page.rb')
-rw-r--r--app/models/page.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/models/page.rb b/app/models/page.rb
index c5da3868..0cfad53a 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -149,6 +149,16 @@ class Page < ActiveRecord::Base
149 published_at.nil? ? true : published_at < Time.now 149 published_at.nil? ? true : published_at < Time.now
150 end 150 end
151 151
152 def effective_lang
153 if translated_locales.empty?
154 return 'de'
155 elsif translated_locales.include?(I18n.locale)
156 return I18n.locale
157 else
158 return translated_locales.first
159 end
160 end
161
152 # Returns true if a page has translations where one of them is significantly 162 # Returns true if a page has translations where one of them is significantly
153 # older than the other. 163 # older than the other.
154 # Takes the I18n.default locale and a second :locale to test if the 164 # Takes the I18n.default locale and a second :locale to test if the
@@ -238,4 +248,4 @@ class Page < ActiveRecord::Base
238 end 248 end
239 end 249 end
240 250
241end \ No newline at end of file 251end