Add class to the link items

This commit is contained in:
benjamin melançon 2018-08-24 09:50:24 -04:00
parent d91434b9b6
commit 7c335eb705

View file

@ -31,8 +31,9 @@
https://gitlab.com/agaric/sites/agaric-com/issues/77 https://gitlab.com/agaric/sites/agaric-com/issues/77
#} #}
{{ menus.menu_links(items, attributes, 0, menu_name) }} {{ menus.menu_links(items, attributes, 0, menu_name) }}
{% set submenu_attributes = create_attribute() %}
{% macro menu_links(items, attributes, menu_level, menu_name) %} {% macro menu_links(items, attributes, menu_level, menu_name) %}
{% set submenu_attributes = create_attribute() %}
{% set link_attributes = create_attribute().addClass('navbar-item') %}
{% import _self as menus %} {% import _self as menus %}
{% set submenu_classes = [ {% set submenu_classes = [
'navbar-item', 'navbar-item',
@ -44,7 +45,7 @@
<div{{ submenu_attributes.addClass(submenu_classes) }}> <div{{ submenu_attributes.addClass(submenu_classes) }}>
{% endif %} {% endif %}
{% for item in items %} {% for item in items %}
{{ link(item.title, item.url) }} {{ link(item.title, item.url, link_attributes) }}
{% if item.below %} {% if item.below %}
{{ menus.menu_links(item.below, attributes, menu_level + 1) }} {{ menus.menu_links(item.below, attributes, menu_level + 1) }}
{% endif %} {% endif %}