Render a list of links with html common options :id and :class ( the
navigator must be configured previously with ‘create_link_navigator’ method )
35: def render_link_navigator(navigator, options = {})
36:
37: return if navigator.links.empty?
38:
39: navigator.html_options[:id] ||= options[:id]
40: navigator.html_options[:class] ||= options[:class]
41:
42: @html = tag('ul', navigator.html_options , true)
43:
44: navigator.links.each do |link|
45:
46: li_options = {}
47: li_options[:id] = "#{link.id}" if link.id
48: li_options[:class] = link.class ? "#{link.class}" : ""
49:
50: if link.is_highlighted?(params) && link.highlight_option_active
51: li_options[:class] += " #{link.highlighted_class}" if link.highlighted_class
52: elsif link.is_disabled?
53: li_options[:class] += " #{link.disabled_class}" if link.disabled_class
54: end
55: li_options[:class] = nil if li_options[:class].blank?
56:
57: attach tag('li', li_options, true)
58: if !link.is_disabled? && !link.url.blank?
59: attach link_to(link.text, link.url, link.html)
60: else
61: attach content_tag('span', link.text, link.html)
62: end
63: attach "</li>\n"
64:
65: end
66: attach '</ul>'
67: @html
68: end