Class: TutorialController
Constant Summary
ApplicationHelper::CONFIG
Instance Method Summary
collapse
#authenticate_admin!, #not_found, #redirect_vonage_domain
#active_sidenav_item, #canonical_base, #canonical_base_from_config, #canonical_path, #canonical_url, #dashboard_cookie, #search_enabled?, #set_utm_cookie, #theme
Instance Method Details
#index ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/nexmo_developer/app/controllers/tutorial_controller.rb', line 25
def index
if @tutorial_step == 'prerequisites'
@content = render_to_string(partial: 'prerequisites', layout: false)
else
@content = Nexmo::Markdown::Renderer.new({
code_language: @code_language,
current_user: current_user,
}).call(@tutorial.content_for(@tutorial_step))
end
if ['introduction', 'conclusion'].include?(@tutorial_step)
@canonical_url = helpers.canonical_base + request.original_fullpath.gsub(%r{^/#{params[:product]}}, '')
else
@canonical_url = "#{helpers.canonical_base}/task/#{@tutorial_step}"
end
render layout: 'documentation'
end
|
#list ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/nexmo_developer/app/controllers/tutorial_controller.rb', line 9
def list
@product = params['product']
@code_language = params['code_language']
if @product
@tutorials = TutorialList.tasks_for_product(@product)
else
@tutorials = TutorialList.all
end
@tutorials = @tutorials.select { |t| t.languages.include?(@code_language) } if @code_language
@document_title = 'Tutorials'
render layout: 'page'
end
|
#single ⇒ Object
47
48
49
50
51
52
53
54
55
|
# File 'lib/nexmo_developer/app/controllers/tutorial_controller.rb', line 47
def single
path = "#{Rails.configuration.docs_base_path}/_tutorials/#{I18n.default_locale}/#{params[:tutorial_step]}.md"
@content = File.read(path)
@content = Nexmo::Markdown::Renderer.new({
code_language: @code_language,
current_user: current_user,
}).call(@content)
render layout: 'documentation'
end
|