lib/locomotive/mounter/reader/api/pages_reader.rb
# Add a new page in the global hash of pages.
# If the page exists, then do nothing.
#
# @param [ String ] fullpath The fullpath used as the key for the hash
# @param [ Hash ] attributes The attributes of the new page
#
# @return [ Object ] A newly created page or the existing one
#
Add a new page in the global hash of pages.
If the page exists, then do nothing.
Add a new page in the global hash of pages . If the page exists then do nothing .
def add(fullpath, attributes = {})
            unless self.pages.key?(fullpath)
              editable_elements = self.filter_editable_elements(attributes.delete('editable_elements'))
              if content_type_slug = attributes.delete('target_klass_slug')
                attributes['content_type'] = self.mounting_point.content_types[content_type_slug] 
              end
              self.pages[fullpath] = Locomotive::Mounter::Models::Page.new(attributes)
              self.pages[fullpath].set_editable_elements(editable_elements)
            end
            self.pages[fullpath]
          end
def add ( fullpath , attributes = { } ) unless self . pages . key? ( fullpath ) editable_elements = self . filter_editable_elements ( attributes . delete ( 'editable_elements' ) ) if content_type_slug = attributes . delete ( 'target_klass_slug' ) attributes [ 'content_type' ] = self . mounting_point . content_types [ content_type_slug ] end self . pages [ fullpath ] = Locomotive :: Mounter :: Models :: Page . new ( attributes ) self . pages [ fullpath ] . set_editable_elements ( editable_elements ) end self . pages [ fullpath ] end
Add a new page in the global hash of pages.
Add a new page in the global hash of pages .
# editable elements # content type #.values.find { |ct| ct._id == content_type_id }
A newly created page or the existing one
A newly created page or the existing one
 Object 
fullpath
<not_specific>
attributes
<not_specific>
<not_specific>
attributes The attributes of the new page
attributes The attributes of the new page