tiss2go/app/helpers/application_helper.rb
Tobias Eidelpes c8bc0ca1cd Implement basic navbar
Signed-off-by: Tobias Eidelpes <tobias@eidelpes.info>
2020-04-07 13:51:05 +02:00

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