Parent

Files

Class Index [+]

Quicksearch

Ubiquo::NavigationTabs::Tab

Attributes

class[RW]

(Not documented)

highlight_option_active[RW]

(Not documented)

highlighted_class[RW]

(Not documented)

highlights[RW]

(Not documented)

html[RW]

(Not documented)

id[RW]

(Not documented)

text[RW]

(Not documented)

title[RW]

(Not documented)

Public Class Methods

new(options = {}) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 8
 8:       def initialize(options = {})
 9: 
10:         # Merge html options with other configuration options

11:         options.merge!(options.delete(:html)||{})
12: 
13:         @text = options[:text] || "tab_text"
14:         @link = options[:link]
15:         @id = options[:id] 
16:         @title = options[:title]
17:         @class = options[:class]
18:         
19:         @html = { :id => @id, :title => @title, :class => @class, :method => options[:method]  }
20:         
21:         # HIGHLIGHT OPTIONS 

22:         @highlight_option_active = options[:highlight_option_active] || true
23:         # Name of class when tab is active

24:         @highlighted_class = options[:highlighted_class] || "active"
25:         
26:         # Set highlights as an array of hashes with :controller=>:value pairs

27:         @highlights = []
28:         if options[:highlights].kind_of?(String)
29:           highlights_on({:controller => options[:highlights]})
30:         elsif options[:highlights].kind_of?(Hash)
31:           highlights_on(options[:highlights])
32:         else
33:           @highlights = options[:highlights]||@highlights
34:         end
35: 
36:         # It does highlight on itself

37:         @highlights << @link if has_link?
38:         
39:       end

Public Instance Methods

class(=(param)) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 51
51:       def class=(param)
52:         @class =  param
53:         @html[:class] = param
54:       end
highlights_on(controller_path) click to toggle source

Puts the name of controllers where tab will be highlightened inside “highlights” array

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 75
75:       def highlights_on controller_path
76:         if controller_path.kind_of?(String)
77:           @highlights << {:controller => controller_path} 
78:         else
79:           @highlights << controller_path
80:         end
81:       end
id=(param) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 41
41:       def id=(param)
42:         @id =  param
43:         @html[:id] = param
44:       end
is_highlighted?(params) click to toggle source

Verifies if a tab must be highlighted in the current controller

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 84
84:       def is_highlighted?(params)
85:         @highlights.each do |hl|
86:           highlighted = true
87:           if hl.kind_of? Hash
88:             hl.each do |key,value|  
89:               v = value.to_s
90:               v.gsub!(/^\//,"") if key == :controller     
91:               
92:               highlighted &&= params[key] && value.to_s == params[key].to_s
93:             end
94:           end
95:           return true if highlighted
96:         end
97:         false
98:       end
title=(param) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 46
46:       def title=(param)
47:         @title =  param
48:         @html[:title] = param
49:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.