23 lines
580 B
Ruby
23 lines
580 B
Ruby
module ApplicationHelper
|
|
# Contains the complete navbar
|
|
def nav_bar
|
|
content_tag(:div, class: 'topnav', id: 'topnav') do
|
|
yield
|
|
end
|
|
end
|
|
|
|
# Defines individual links in the navbar. To be used inside nav_bar
|
|
def nav_link(text, path)
|
|
# Sets active class on the link corresponding to the page being viewed
|
|
options = current_page?(path) ? { class: 'active' } : {}
|
|
link_to text, path, options
|
|
end
|
|
|
|
# Used to render svg image files
|
|
def show_svg(path)
|
|
File.open("app/assets/images/#{path}", 'rb') do |file|
|
|
raw file.read
|
|
end
|
|
end
|
|
end
|