Алёна спасибо за вариант, немного не то :( Смотри что мне нужно сделать, надо для главной страницы получить такой вариант:
*<li><a href="/admin" class="sidebar-link dashboard" id="current"><i class="ico ico-sidebar ico-dashboard"></i>Главная</a></li>* * * А потом ниже достать из массива в helper меню и разбросать его по такому же варианту: * * *<li><a href="/admin" class="sidebar-link dashboard" id=" "><i class="ico ico-sidebar ico-oders"></i>Заказы</a></li>** * * * *<li><a href="/admin" class="sidebar-link dashboard" id=""><i class="ico ico-sidebar ico-c**ustomers**"></i>Покупатели</a></li>* * * *<li><a href="/admin" class="sidebar-link dashboard" id="current"><i class="ico ico-sidebar ico-p**roducts**"></i>Товары</a></li>* * * *<li><a href="/admin" class="sidebar-link dashboard" id=""><i class="ico ico-sidebar ico-c**ollections**"></i>Коллекции</a></li>* * * * * current- назначается включенной в данный момент странице, и для нее включается стиль css 'current' как для активной, когда то это все работало на js теперь сменили правительство и нужно реализовать все в коде, так как массив они еще где то используют, вот сижу уже 2 день и пытаюсь найти правильный вариант :) * * * * * * * * пятница, 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.