lib/locomotive/mounter/reader/api/pages_reader.rb
# Tell is a page described is a sub page of a parent page
#
# @param [ Object ] page The full path of the page to test
# @param [ Object ] parent The full path of the parent page
#
# @return [ Boolean] True if the page is a sub page of the parent one
#
Tell is a page described is a sub page of a parent page
Tell is a page described is a sub page of a parent page
def is_subpage_of?(page, parent)
            return false if page.index_or_404?
            page_fullpath = page.try(:_fullpath) || page.fullpath
            parent_fullpath = parent.try(:_fullpath) || parent.fullpath
            if page.parent_id 
              return page.parent_id == parent._id
            end
            if page_fullpath == 'index' && page_fullpath.split('/').size == 1
              return true
            end
            File.dirname(page_fullpath.dasherize) == parent_fullpath.dasherize
          end
def is_subpage_of? ( page , parent ) return false if page . index_or_404? page_fullpath = page . try ( :_fullpath ) || page . fullpath parent_fullpath = parent . try ( :_fullpath ) || parent . fullpath if page . parent_id return page . parent_id == parent . _id end if page_fullpath == 'index' && page_fullpath . split ( '/' ) . size == 1 return true end File . dirname ( page_fullpath . dasherize ) == parent_fullpath . dasherize end
Tell is a page described is a sub page of a parent page
Tell is a page described is a sub page of a parent page
# only in the new version of the engine
True if the page is a sub page of the parent one
True if the page is a sub page of the parent one
 Boolean
page
<not_specific>
parent
<not_specific>
<not_specific>
parent The full path of the parent page
parent The full path of the parent page