Object
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 9
9: def initialize(options = {})
10:
11: # Merge html options with other configuration options
12: options.merge!(options.delete(:html)||{})
13:
14: @text = options[:text] || "link_text"
15: @url = options[:url]
16:
17: @id = options[:id]
18: @class = options[:class]
19:
20: @disabled = options[:disabled]
21: @disabled_class = options[:disabled_class]
22:
23: @html = { :title => options[:title], :method => options[:method] }
24:
25: # HIGHLIGHT OPTIONS
26: @highlight_option_active = options[:highlight_option_active] || true
27: # Name of class for highlighting the link when ubiquo user is in a 'highlight place'
28: @highlighted_class = options[:highlighted_class] || "active"
29:
30: # Set highlights as an array of hashes with :controller=>:value pairs
31: @highlights = []
32: if options[:highlights].kind_of?(String)
33: highlights_on({:controller => options[:highlights]})
34: elsif options[:highlights].kind_of?(Hash)
35: highlights_on(options[:highlights])
36: else
37: @highlights = options[:highlights]||@highlights
38: end
39:
40: # It does highlight on itself
41: @highlights << @url if has_url?
42:
43: end
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 66
66: def has_url?
67: !@url.blank?
68: end
Puts inside highlights array the controllers where tab will be highlightened
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 72
72: def highlights_on controller_path
73: if controller_path.kind_of?(String)
74: @highlights << {:controller => controller_path}
75: else
76: @highlights << controller_path
77: end
78: end
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 97
97: def is_disabled?
98: (@disabled||false)
99: end
Verifies if a tab must be highlighted in the current controller
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 81
81: def is_highlighted?(params)
82: @highlights.each do |hl|
83: highlighted = true
84: if hl.kind_of? Hash
85: hl.each do |key,value|
86: v = value.to_s
87: v.gsub!(/^\//,"") if key == :controller
88:
89: highlighted &&= params[key] && value.to_s == params[key].to_s
90: end
91: end
92: return true if highlighted
93: end
94: false
95: end
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 49
49: def title
50: @html[:title]
51: end
(Not documented)
# File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 45
45: def title=(param)
46: @html[:title] = param
47: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.