Files

Class Index [+]

Quicksearch

Ubiquo::NavigationTabs::Helpers

Protected Instance Methods

attach(string) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/helpers.rb, line 69
69:       def attach(string)
70:         @html += string
71:       end
create_tab_navigator(options = {}, &block) click to toggle source

Create a Navigator instance

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/helpers.rb, line 27
27:       def create_tab_navigator (options = {}, &block)
28:         navigator = NavigatorTabs.new(options)
29:         block.call(navigator)
30:         navigator
31:       end
render_navigation_tabs_section(navtab_file_name, options = {}) click to toggle source

Render a partial view that contains navigaton tab elements

In view file: <%= render_navigation_tabs_section :main %>

renders “navigators/main_navtabs“ partial

:options

  :partial => specify the view directory for partial file
    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/helpers.rb, line 21
21:       def render_navigation_tabs_section (navtab_file_name, options = {})
22:         partial_template = options[:partial] || "navigators/#{navtab_file_name}_navtabs"
23:         render :partial => partial_template
24:       end
render_tab_navigator(navigator, options = {}) click to toggle source

Render a list of tabs with html common options (:id and :class) ( the navigator must be configured previously with ‘create_tab_navigator’ method )

The option :sort can be used to sort tabs by alphabet

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/helpers.rb, line 37
37:       def render_tab_navigator(navigator, options = {})
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:         navigator.sort! if options[:sort] == true
44:         
45:         navigator.tabs.each do |tab|      
46:           li_options = {}
47: 
48:           li_options[:id] = "#{tab.id}" if tab.id
49:           li_options[:title] = "#{tab.title}" if tab.title
50:           li_options[:class] = "#{tab.class}" if tab.class
51: 
52:           if tab.is_highlighted?(params) && tab.highlight_option_active
53:             li_options[:class] = "#{tab.highlighted_class}" if tab.highlighted_class
54:           end
55: 
56:           attach tag('li', li_options, true)
57:           if tab.has_link?
58:             attach link_to(tab.text, tab.link, tab.html)
59:           else
60:             attach content_tag('span', tab.text, tab.html) 
61:           end
62:           attach "</li>\n"
63:         end
64:         attach '</ul>'
65: 
66:         @html
67:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.