Here is my code, and you must install a tag:
* %li=link_to "Main", user_root_path, id: is_home? && :current, class:
'sidebar-link dashboard'*
Here's the tag:
* %i.ico.ico-sidebar.ico-dashboard*
*
*
*this version does not suit me:
*
*
*
* %li*
* %a*
* %i*
* Main*
*
*
*as a label for determining the selected position in the menu, and much
more,*
*if someone is able to offer another option here is the complete code of
the menu and helper:
*
*
*
*
*
*
%li=link_to "Главная", user_root_path, id: is_home? && :current, class:
'sidebar-link dashboard'
-menus.each do |menu|
%li=link_to menu[:label], menu[:url], id: current(menu), class:
(menu[:css])
*
*
*
*helper:*
*
*
*
*
*
def menus
@menus ||= [
{ label: orders_menu_label, url: orders_path, css: 'sidebar-link
orders' },
{ label: 'Customers', url: customers_path, css: 'sidebar-link
customers' },
{ label: 'Products', url: products_path, css: 'sidebar-link products'
},
{ label: 'Collections', url: custom_collections_path, css:
'sidebar-link collections' },
{ label: 'Discounts', url: discounts_path, css: 'sidebar-link
discounts' }
]
@menus
end
def current(menu)
request.path.start_with?(menu[:url]) ? :current : ' '
end
*
*
*
*
*
*thank you guys for the help
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
--
You received this message because you are subscribed to the Google Groups
"Haml" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/haml.
For more options, visit https://groups.google.com/groups/opt_out.