Parent

Files

Class Index [+]

Quicksearch

Ubiquo::NavigationLinks::Link

Attributes

class[RW]

(Not documented)

disabled[RW]

(Not documented)

disabled_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)

url[RW]

(Not documented)

Public Class Methods

new(options = {}) click to toggle source

(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

Public Instance Methods

has_url?() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 66
66:       def has_url?
67:         !@url.blank?
68:       end
highlights_on(controller_path) click to toggle source

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
is_disabled?() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 97
97:       def is_disabled?
98:         (@disabled||false)
99:       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_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
title() click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 49
49:       def title
50:         @html[:title]
51:       end
title=(param) click to toggle source

(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
url(url_path = nil) click to toggle source

(Not documented)

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 53
53:       def url (url_path = nil)
54:         if url_path
55:           @url = url_path if @url.blank?
56:         else
57:           @url 
58:         end
59:       end
url_if(bool, url_path) click to toggle source

order when calling link_if when a tab is created determines the link that will be shown

    # File vendor/plugins/ubiquo_core/lib/ubiquo/navigation_links/link.rb, line 62
62:       def url_if(bool, url_path)
63:         @url = url_path if @url.blank? && bool
64:       end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.