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
- #link_to_background(item_symbol) ⇒ Object
- #link_to_cribsheet(item_symbol) ⇒ Object
-
#link_to_homework(citem, attrs = {}) ⇒ Object
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.
- #link_to_inclusion(item) ⇒ Object
- #link_to_incubator(item_symbol) ⇒ Object
- #link_to_intro(item_symbol) ⇒ Object
- #link_to_lab(item_symbol) ⇒ Object
- #link_to_lecture(item_symbol) ⇒ Object
- #link_to_next(toc, item, attrs = {}) ⇒ Object
- #link_to_next_lecture ⇒ Object
- #link_to_pa(item_symbol) ⇒ Object
- #link_to_page(item_symbol) ⇒ Object
- #link_to_prev(toc, item, attrs = {}) ⇒ Object
- #link_to_project(item_symbol) ⇒ Object
- #link_to_section(section_symbol, item_symbol) ⇒ Object
-
#link_to_slides(attrs = {}) ⇒ Object
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.
- #link_to_topic(item_symbol) ⇒ Object
Instance Method Details
#link_to_background(item_symbol) ⇒ Object
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 |
#link_to_cribsheet(item_symbol) ⇒ Object
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 |
#link_to_homework(citem, attrs = {}) ⇒ Object
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 |
#link_to_inclusion(item) ⇒ Object
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 |
#link_to_incubator(item_symbol) ⇒ Object
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 |
#link_to_intro(item_symbol) ⇒ Object
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 |
#link_to_lab(item_symbol) ⇒ Object
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 |
#link_to_lecture(item_symbol) ⇒ Object
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 |
#link_to_next(toc, item, attrs = {}) ⇒ Object
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 |
#link_to_next_lecture ⇒ Object
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 |
#link_to_pa(item_symbol) ⇒ Object
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 |
#link_to_page(item_symbol) ⇒ Object
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 |
#link_to_prev(toc, item, attrs = {}) ⇒ Object
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 |
#link_to_project(item_symbol) ⇒ Object
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 |
#link_to_section(section_symbol, item_symbol) ⇒ Object
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 |
#link_to_slides(attrs = {}) ⇒ Object
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 (attrs = {}) link_to("slides", "./slides.html", attrs) end |
#link_to_topic(item_symbol) ⇒ Object
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 |