Not sure if there's a better way though
class NavList
attr_accessor :request
include ActionView::Helpers::TagHelper
include ActionView::Helpers::UrlHelper
def header(title)
content_tag :li, title, class: 'nav-header'
end
def link(title, path, opts={class: ''})
opts[:class] = "#{opts[:class]} active" if current_page?(path)
content_tag :li, link_to(title, path), class: opts[:class]
end
end
def nav_list(&block)
new_block = Proc.new do
helper = NavList.new
helper.request = request
block.call(helper)
end
content_tag :ul, capture(&new_block), class: 'nav nav-list'
end