Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge remote branch 'rocksolidwebdesign/master'

  • Loading branch information...
commit 47736262da354e08c6c096ba7d72e2831034b6b1 2 parents 17e5999 + 7db3cc4
@parndt parndt authored
View
7 pages/app/controllers/admin/pages_controller.rb
@@ -28,7 +28,12 @@ def globalize!
# Check whether we need to override e.g. on the pages form.
unless params[:switch_locale] or @page.nil? or @page.slugs.where(:locale => Refinery::I18n.current_locale).nil? or !@page.persisted?
- Thread.current[:globalize_locale] = @page.slug.locale
+ if @page.slug.nil? and @page.slugs.length > 0
+ @page.slug = @page.slugs[0]
+ end
+ if @page.slug
+ Thread.current[:globalize_locale] = @page.slug.locale
+ end
end
else
Thread.current[:globalize_locale] = nil
View
15 pages/app/models/page.rb
@@ -5,11 +5,11 @@ class Page < ActiveRecord::Base
translates :title, :meta_keywords, :meta_description, :browser_title, :custom_title if self.respond_to?(:translates)
# Set up support for meta tags through translations.
- if defined?(::Page::Translation) && Page::Translation.table_exists?
+ if defined?(::Page::Translation) && ::Page::Translation.table_exists?
def translation
- if @translation.nil? or @translation.try(:locale) != Globalize.locale
- @translation = translations.with_locale(Globalize.locale).first
- @translation ||= translations.build(:locale => Globalize.locale)
+ if @translation.nil? or @translation.try(:locale) != ::Globalize.locale
+ @translation = translations.with_locale(::Globalize.locale).first
+ @translation ||= translations.build(:locale => ::Globalize.locale)
end
@translation
@@ -293,7 +293,12 @@ def [](part_title)
# In the admin area we use a slightly different title to inform the which pages are draft or hidden pages
def title_with_meta
- title = [self.title.to_s]
+ if self.title.nil?
+ title = [::Page::Translation.where(:page_id => self.id).first.title.to_s]
+ else
+ title = [self.title.to_s]
+ end
+
title << "<em>(#{::I18n.t('hidden', :scope => 'admin.pages.page')})</em>" unless show_in_menu?
title << "<em>(#{::I18n.t('draft', :scope => 'admin.pages.page')})</em>" if draft?
Please sign in to comment.
Something went wrong with that request. Please try again.