Class: Bootybox::NavigationalContextPagesService

Inherits:
Object
  • Object
show all
Defined in:
app/services/bootybox/navigational_context_pages_service.rb

Constant Summary collapse

[:parent, :previous, :next]

Class Method Summary collapse

Class Method Details

.get(page, nav_type = :parent) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'app/services/bootybox/navigational_context_pages_service.rb', line 5

def self.get(page, nav_type = :parent)
  raise "Wrong navigational type '#{nav_type.inspect}' use #{ALLOWED_NAVIGATION_LINKS.inspect}" if ALLOWED_NAVIGATION_LINKS.index(nav_type).nil?
  nav_page = page.send(nav_type)
  if nav_page && !nav_page.link_container && nav_page.public && nav_page.urlname.present?
    return nav_page
  else
    return nil
  end    
end