Implement basic navbar

Signed-off-by: Tobias Eidelpes <tobias@eidelpes.info>
This commit is contained in:
2020-04-07 13:51:05 +02:00
parent e769fffed7
commit c8bc0ca1cd
8 changed files with 126 additions and 1 deletions
+20
View File
@@ -1,2 +1,22 @@
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