Module: NavigationHelpers

Defined in:
lib/coursegen/course/helpers/navigation_helpers.rb

Overview

NavigationHelpers provides methods for navigating the course. This is used in the nav bar along the top of the page. Called by main_navbar.html.erb

Instance Method Summary collapse

Instance Method Details



19
20
21
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 19

def link_to_background(item_symbol)
  link_to_section :background, item_symbol
end


23
24
25
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 23

def link_to_cribsheet(item_symbol)
  link_to_section :cribsheets, item_symbol
end

def link_to_homework_2(citem)

unless citem.hwref.nil?
  "<div class=\"btn btn-sm btn-primary\">" +
  "<i class=\"fad fa-backpack\"></i>" +
  link_to_section(:homework, citem.hwref.to_sym) +
  "</div>"
end

end



97
98
99
100
101
102
103
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 97

def link_to_homework(citem, attrs = {})
  return "" if citem.hwref.nil?

  the_item = @items[lookup_nitem("homework", citem.hwref).identifier]
  # link_to(the_item[:title], the_item, attrs)
  link_to("homework", the_item, attrs)
end


66
67
68
69
70
71
72
73
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 66

def link_to_inclusion(item)
  inclusion = Toc.instance.lookup_inclusion(item)
  if inclusion.nil?
    '(never included)'
  else
    " (#{inclusion.identifier})"
  end
end


31
32
33
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 31

def link_to_incubator(item_symbol)
  link_to_section :incubator, item_symbol
end


27
28
29
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 27

def link_to_intro(item_symbol)
  link_to_section :intro, item_symbol
end


35
36
37
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 35

def link_to_lab(item_symbol)
  link_to_section :lab, item_symbol
end


5
6
7
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 5

def link_to_lecture(item_symbol)
  link_to_section :lectures, item_symbol
end


56
57
58
59
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 56

def link_to_next(toc, item, attrs = {})
  next_nitem = toc.find_next_forn(item).identifier
  link_to 'next', @items[next_nitem].path, attrs
end


9
10
11
12
13
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 9

def link_to_next_lecture
  the_citem = Toc.instance.find_next_forn(@item)
  the_item = @items[the_citem.identifier]
  link_to(the_citem.title, the_item)
end


39
40
41
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 39

def link_to_pa(item_symbol)
  link_to_section :pa, item_symbol
end


43
44
45
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 43

def link_to_page(item_symbol)
  link_to_section :pages, item_symbol
end


61
62
63
64
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 61

def link_to_prev(toc, item, attrs = {})
  prev_nitem = toc.find_previous_forn(item).identifier
  link_to 'previous', @items[prev_nitem].path, attrs
end


47
48
49
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 47

def link_to_project(item_symbol)
  link_to_section :projects, item_symbol
end


51
52
53
54
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 51

def link_to_section(section_symbol, item_symbol)
  the_item = @items[lookup_nitem(section_symbol.to_s, item_symbol.to_s).identifier]
  link_to(the_item[:title], the_item)
end

def link_to_slides_2

'<a
  class="btn btn-sm btn-primary"
  href="./slides.html"
  title="slides">
  <i class="fas fa-chalkboard-teacher"></i> Slides
</a>'

end



84
85
86
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 84

def link_to_slides(attrs = {})
  link_to("slides", "./slides.html", attrs)
end


15
16
17
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 15

def link_to_topic(item_symbol)
  link_to_section :topics, item_symbol
end