Add navigation menu

This commit is contained in:
2023-04-21 20:22:16 +02:00
parent 86798d8e39
commit 86dbc95375
7 changed files with 65 additions and 31 deletions

View File

@@ -45,10 +45,12 @@ module ApplicationHelper
end
def image_link_to(name, image = nil, options = nil, html_options = {})
return "" if html_options.delete(:unless_current) && (url_for(options) == request.path)
current = html_options.delete(:current)
return "" if (current == :hide) && (url_for(options) == request.path)
classes = class_names(html_options[:class], "image-button", active: current == :active)
name = svg_tag("pictograms/#{image}.svg#icon") + name if image
link_to name, options, html_options.merge!(class: "image-button") { |k, v1, v2| "#{v1} #{v2}" }
link_to name, options, class: classes
end
def svg_tag(source, options = {})