Class: MarkdownController

Inherits:
ApplicationController show all
Defined in:
lib/nexmo_developer/app/controllers/markdown_controller.rb

Constant Summary

Constants included from ApplicationHelper

ApplicationHelper::CONFIG

Instance Method Summary collapse

Methods inherited from ApplicationController

#authenticate_admin!, #not_found, #redirect_vonage_domain

Methods included from ApplicationHelper

#active_sidenav_item, #canonical_base, #canonical_base_from_config, #canonical_path, #canonical_url, #dashboard_cookie, #search_enabled?, #set_utm_cookie, #theme

Instance Method Details

#apiObject



35
36
37
38
39
40
41
42
# File 'lib/nexmo_developer/app/controllers/markdown_controller.rb', line 35

def api
  redirect = Redirector.find(request)
  if redirect
    redirect_to redirect
  else
    render_not_found
  end
end

#showObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/nexmo_developer/app/controllers/markdown_controller.rb', line 8

def show
  if path_is_folder?
    @frontmatter, @content = content_from_folder
  else
    @document_path = document.path
    @frontmatter, @content = content_from_file
    set_canonical_url
  end

  @document_title = @frontmatter['meta_title'] || @frontmatter['title']

  @sidenav = Sidenav.new(
    namespace: params[:namespace],
    locale: params[:locale],
    request_path: request.path,
    navigation: @navigation,
    code_language: params[:code_language],
    product: @product
  )

  if !Rails.env.development? && @frontmatter['wip']
    render 'wip', layout: 'documentation'
  else
    render layout: 'documentation'
  end
end