Object
(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
(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
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 69
69: def has_link?
70: !@link.blank?
71: end
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
(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
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
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 56
56: def link(link_url=nil)
57: if link_url
58: @link = link_url if @link.blank?
59: else
60: @link
61: end
62: end
Method to set link information to Tab if it hasn’t got any and condition value is true
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_tabs/tab.rb, line 65
65: def link_if(bool, link_url)
66: @link = link_url if @link.blank? && bool
67: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.