class Tabulous::BootstrapRenderer
Public Instance Methods
tabs_html()
click to toggle source
# File lib/tabulous/renderers/bootstrap_renderer.rb, line 6 def tabs_html <<-HTML.strip_heredoc <ul class="nav nav-tabs"> #{ tab_list_html } </ul> HTML end
Protected Instance Methods
tab_html(tab)
click to toggle source
# File lib/tabulous/renderers/bootstrap_renderer.rb, line 16 def tab_html(tab) return '' unless tab.visible?(@view) html = '' klass = '' klass << 'active' if tab.active?(@view) klass << ' disabled' unless tab.enabled?(@view) klass << ' dropdown' if tab.subtabs.any? klass.strip! if klass.empty? html << '<li>' else html << %Q{<li class="#{klass}">} end if tab.subtabs.empty? html << tab_link(tab) else html << tab_link_with_subtabs(tab) end html << "</li>" html end
tab_link(tab)
click to toggle source
# File lib/tabulous/renderers/bootstrap_renderer.rb, line 38 def tab_link(tab) html = '' if tab.clickable?(@view) && tab.enabled?(@view) html << %Q{<a href="#{tab_url(tab)}" #{tab_http_verb_attributes(tab)}>#{tab_text(tab)}</a>} else html << %Q{<a>#{tab_text(tab)}</a>} end html end
tab_link_with_subtabs(tab)
click to toggle source
# File lib/tabulous/renderers/bootstrap_renderer.rb, line 48 def tab_link_with_subtabs(tab) html = '' html << %Q{<a class="dropdown-toggle" data-toggle="dropdown" href="#">#{tab_text(tab)}<b class="caret"></b></a>} html << %Q{<ul class="dropdown-menu">} for subtab in tab.subtabs next unless subtab.visible?(@view) klass = (subtab.enabled?(@view) ? '' : 'disabled') if klass.empty? html << '<li>' else html << %Q{<li class="#{klass}">} end html << tab_link(subtab) html << "</li>" end html << "</ul>" html end