lib/locomotive/mounter/reader/api/pages_reader.rb
# Record pages found in file system
Record pages found in file system
Record pages found in file system
def fetch
            self.get(:pages).each do |attributes|
              fullpath = attributes['_fullpath'] || attributes['fullpath']
              page = self.add(fullpath, attributes)
              self.mounting_point.locales[1..-1].each do |locale|
                next unless page.translated_in?(locale)
                Locomotive::Mounter.with_locale(locale) do
                  localized_attributes = self.get("pages/#{page._id}", locale)
                  localized_attributes.delete('target_klass_slug')
                  editable_elements = self.filter_editable_elements(localized_attributes.delete('editable_elements'))
                  page.attributes = localized_attributes
                  page.set_editable_elements(editable_elements)
                end
              end
            end
          end
def fetch self . get ( :pages ) . each do | attributes | fullpath = attributes [ '_fullpath' ] || attributes [ 'fullpath' ] page = self . add ( fullpath , attributes ) self . mounting_point . locales [ 1 .. - 1 ] . each do | locale | next unless page . translated_in? ( locale ) Locomotive :: Mounter . with_locale ( locale ) do localized_attributes = self . get ( "pages/#{page._id}" , locale ) localized_attributes . delete ( 'target_klass_slug' ) editable_elements = self . filter_editable_elements ( localized_attributes . delete ( 'editable_elements' ) ) page . attributes = localized_attributes page . set_editable_elements ( editable_elements ) end end end end
Record pages found in file system
Record pages found in file system
# if not translated, no need to make an api call for that locale # remove useless non localized attributes # isolate the editable elements