Method: Cms::MobileAware#determine_page_layout

Defined in:
lib/cms/mobile_aware.rb

#determine_page_layoutString

Looks for a mobile template if the request is mobile, falling back to the html template if it can’t be found.

Returns:

  • (String)

    relative path/name of the layout to be rendered by a page (i.e. ‘layouts/templates/default’)



10
11
12
13
14
15
16
# File 'lib/cms/mobile_aware.rb', line 10

def determine_page_layout
  if respond_as_mobile?
    mobile_exists = template_exists?(@page.layout_name, "layouts/mobile")
    return @page.layout(:mobile) if mobile_exists
  end
  @page.layout(:full)
end