Алёнка спасибо тебе за вариант, я немного с ним поигрался и нашел правильный вариант :)
Вот как я вышел из ситуации: -------------------------------------------------------------------------------------------------------------------------------------------------------------- * | %li | =link_to user_root_path, id: is_home? && :current, class: 'sidebar-link dashboard' do | %i.ico.ico-sidebar.ico-dashboard | ="Главная" | -menus.each do |menu| | %li | =link_to menu[:url], id: current(menu), class: (menu[:css]) do | %i(class="#{menu[:ico]}") | #{menu[:label]} * -------------------------------------------------------------------------------------------------------------------------------------------------------------- А вот что теперь в helper: * def menus @menus ||= [ { label: orders_menu_label, url: orders_path, css: 'sidebar-link orders', ico: 'ico ico-sidebar ico-orders' }, { label: 'Клиенты', url: customers_path, css: 'sidebar-link customers', ico: 'ico ico-sidebar ico-customers' }, { label: 'Товары', url: products_path, css: 'sidebar-link products', ico: 'ico ico-sidebar ico-products' }, { label: 'Коллекции', url: custom_collections_path, css: 'sidebar-link collections', ico: 'ico ico-sidebar ico-collections' }, { label: 'Продвижение', url: discounts_path, css: 'sidebar-link discounts', ico: 'ico ico-sidebar ico-discounts' } ] @menus end * ------------------------------------------------------------------------------------------------------------------------------------------------------------- Проверка *current:* * * * * * def current(menu) #(current_page?(menu[:url]) ? :current : '') request.path.start_with?(menu[:url]) ? :current : '' end * -------------------------------------------------------------------------------------------------------------------------------------------------------------- Твой вариант с "*do*" помог мне решить проблему встраивания в HAML тега в тег :) *СПАСИБО! * пятница, 28 июня 2013 г., 5:21:11 UTC+3 пользователь Кирилл Петренко написал: > > > 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 haml+unsubscr...@googlegroups.com. To post to this group, send email to haml@googlegroups.com. Visit this group at http://groups.google.com/group/haml. For more options, visit https://groups.google.com/groups/opt_out.