This way we generate the same HTML as we generate everywhere where we manually generate lists of links. Having a blank space betwwen tags results in a space being introduced when the elements are displayed inline (or with `inline-block`). So in places where we don't want that space between the elements we have to use a flex layout.
14 lines
347 B
Ruby
14 lines
347 B
Ruby
module LinkListHelper
|
|
def link_list(*links, **options)
|
|
return "" if links.compact.empty?
|
|
|
|
tag.ul(options) do
|
|
safe_join(links.compact.map do |text, url, current = false, **link_options|
|
|
tag.li(({ "aria-current": true } if current)) do
|
|
link_to text, url, link_options
|
|
end
|
|
end, "\n")
|
|
end
|
|
end
|
|
end
|