Module: NavigationHelpers

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

Overview

Used in the nav bar along the top of the page. Called by main_navbar.html.erb

Instance Method Summary collapse

Instance Method Details



17
18
19
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 17

def link_to_background item_symbol
  link_to_section :background, item_symbol
end


21
22
23
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 21

def link_to_cribsheet item_symbol
  link_to_section :cribsheets, item_symbol
end


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

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


29
30
31
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 29

def link_to_incubator item_symbol
  link_to_section :incubator, item_symbol
end


25
26
27
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 25

def link_to_intro item_symbol
  link_to_section :intro, item_symbol
end


33
34
35
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 33

def link_to_lab item_symbol
  link_to_section :lab, item_symbol
end


3
4
5
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 3

def link_to_lecture item_symbol
  link_to_section :lectures, item_symbol
end


54
55
56
57
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 54

def link_to_next toc, item
  next_nitem = toc.find_next_forn(item).identifier
  nav_markup "", @items[next_nitem].path, "glyphicon glyphicon-arrow-right", "next page"
end


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

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


37
38
39
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 37

def link_to_pa item_symbol
  link_to_section :pa, item_symbol
end


41
42
43
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 41

def link_to_page item_symbol
  link_to_section :pages, item_symbol
end


59
60
61
62
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 59

def link_to_prev toc, item
  prev_nitem = toc.find_previous_forn(item).identifier
  nav_markup "", @items[prev_nitem].path, "glyphicon glyphicon-arrow-left", "previous page"
end


45
46
47
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 45

def link_to_project item_symbol
  link_to_section :projects, item_symbol
end


49
50
51
52
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 49

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


13
14
15
# File 'lib/coursegen/course/helpers/navigation_helpers.rb', line 13

def link_to_topic item_symbol
  link_to_section :topics, item_symbol
end