Class: SidenavSubitem
- Inherits:
-
SidenavItem
- Object
- SidenavItem
- SidenavSubitem
- Defined in:
- lib/nexmo_developer/app/presenters/sidenav_subitem.rb
Instance Method Summary collapse
- #build_url ⇒ Object
- #collapsible? ⇒ Boolean
- #controller ⇒ Object
- #show_link? ⇒ Boolean
- #title ⇒ Object
- #url ⇒ Object
Methods inherited from SidenavItem
#children, #css_classes, #initialize, #label, #label?, #link_url, #normalized_title, #svg, #svg?, #svg_color
Constructor Details
This class inherits a constructor from SidenavItem
Instance Method Details
#build_url ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# 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.new(@folder) url_for( controller: :markdown, action: :show, document: .document, namespace: namespace, only_path: true, locale: locale ) else = Navigation.new(@folder) url_for( controller: :markdown, action: :show, document: .document, product: .product, only_path: true, locale: locale ) end end |
#collapsible? ⇒ Boolean
15 16 17 |
# File 'lib/nexmo_developer/app/presenters/sidenav_subitem.rb', line 15 def collapsible? @options['collapsible'].nil? || @options['collapsible'] end |
#controller ⇒ Object
64 65 66 67 68 69 70 |
# 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 |
#show_link? ⇒ Boolean
11 12 13 |
# File 'lib/nexmo_developer/app/presenters/sidenav_subitem.rb', line 11 def show_link? @folder[:is_file?] || @folder[:is_tabbed?] end |
#title ⇒ Object
4 5 6 7 8 9 |
# 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 ⇒ Object
19 20 21 |
# File 'lib/nexmo_developer/app/presenters/sidenav_subitem.rb', line 19 def url @url ||= @folder[:external_link] || build_url end |