app/models/locomotive/extensions/site/locales.rb
# Verify if the index and 404 pages in ALL the locales of the site
# have a non empty slug, fullpath and title. If not, it sets them.
#
Verify if the index and 404 pages in ALL the locales of the site
have a non empty slug, fullpath and title. If not, it sets them.
Verify if the index and 404 pages in ALL the locales of the site have a non empty slug fullpath and title . If not it sets them .
def verify_localized_default_pages_integrity
          if self.persisted? && self.locales_changed?
            self.pages.where(:"slug.#{self.default_locale_was}".in => %w(index 404), depth: 0).each do |page|
              modifications = { 'title' => {}, 'slug' => {}, 'fullpath' => {}, 'locales' => self.locales }
              self.locales.each do |locale|
                slug  = page.attributes['slug'][self.default_locale_was]
                title = page.attributes['title'][locale] || ::I18n.t("attributes.defaults.pages.#{slug}.title", locale: locale)
                modifications['slug'][locale]     = slug
                modifications['fullpath'][locale] = slug
                modifications['title'][locale]    = title
              end
              page.collection.find(_id: page._id).update('$set' => modifications)
            end
          end
        end
def verify_localized_default_pages_integrity if self . persisted? && self . locales_changed? self . pages . where ( :" slug. #{ self . default_locale_was } " . in => %w( index 404 ) , depth : 0 ) . each do | page | modifications = { 'title' => { } , 'slug' => { } , 'fullpath' => { } , 'locales' => self . locales } self . locales . each do | locale | slug = page . attributes [ 'slug' ] [ self . default_locale_was ] title = page . attributes [ 'title' ] [ locale ] || :: I18n . t ( "attributes.defaults.pages.#{slug}.title" , locale : locale ) modifications [ 'slug' ] [ locale ] = slug modifications [ 'fullpath' ] [ locale ] = slug modifications [ 'title' ] [ locale ] = title end page . collection . find ( _id : page . _id ) . update ( '$set' => modifications ) end end end
Verify if the index and 404 pages in ALL the locales of the site
have a non empty slug, fullpath and title.
Verify if the index and 404 pages in ALL the locales of the site have a non empty slug fullpath and title .