class SidenavSubitem

Public Instance Methods

build_url() click to toggle source
# File lib/nexmo_developer/app/presenters/sidenav_subitem.rb, line 23
def build_url
  if @folder[:root] == Tutorial.tutorials_path
    url_for(
      tutorial_name: Navigation.new(@folder).path_to_url,
      controller: :tutorial,
      action: :index,
      product: @folder[:product],
      only_path: true,
      locale: locale
    )
  elsif @folder[:root] == "#{Rails.configuration.docs_base_path}/_use_cases"
    url_for(
      document: Navigation.new(@folder).path_to_url,
      controller: controller,
      action: :show,
      only_path: true,
      locale: locale
    )
  elsif @folder[:path].starts_with?('app/views')
    navigation = Navigation.new(@folder)
    url_for(
      controller: :markdown,
      action: :show,
      document: navigation.document,
      namespace: namespace,
      only_path: true,
      locale: locale
    )
  else
    navigation = Navigation.new(@folder)
    url_for(
      controller: :markdown,
      action: :show,
      document: navigation.document,
      product: navigation.product,
      only_path: true,
      locale: locale
    )
  end
end
collapsible?() click to toggle source
# File lib/nexmo_developer/app/presenters/sidenav_subitem.rb, line 15
def collapsible?
  @options['collapsible'].nil? || @options['collapsible']
end
controller() click to toggle source
# File lib/nexmo_developer/app/presenters/sidenav_subitem.rb, line 64
def controller
  if @folder[:path].starts_with?("#{Rails.configuration.docs_base_path}/_documentation")
    :markdown
  elsif @folder[:path].starts_with?("#{Rails.configuration.docs_base_path}/_use_cases")
    :use_case
  end
end
title() click to toggle source
# File lib/nexmo_developer/app/presenters/sidenav_subitem.rb, line 4
def title
  @title ||= TitleNormalizer.call(@folder)
  raise "Missing 'title' in frontmatter for #{@folder[:path]}" unless @title

  @title
end
url() click to toggle source
# File lib/nexmo_developer/app/presenters/sidenav_subitem.rb, line 19
def url
  @url ||= @folder[:external_link] || build_url
end