Class: Radiant::AdminUI::NavSubItem

Inherits:
Object
  • Object
show all
Defined in:
lib/radiant/admin_ui.rb

Overview

Simple structure for storing the properties of a tab’s sub items.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, proper_name, url = "#") ⇒ NavSubItem

Returns a new instance of NavSubItem.



67
68
69
# File 'lib/radiant/admin_ui.rb', line 67

def initialize(name, proper_name, url = "#")
  @name, @proper_name, @url = name, proper_name, url
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



64
65
66
# File 'lib/radiant/admin_ui.rb', line 64

def name
  @name
end

#proper_nameObject (readonly)

Returns the value of attribute proper_name.



64
65
66
# File 'lib/radiant/admin_ui.rb', line 64

def proper_name
  @proper_name
end

#tabObject

Returns the value of attribute tab.



65
66
67
# File 'lib/radiant/admin_ui.rb', line 65

def tab
  @tab
end

#urlObject (readonly)

Returns the value of attribute url.



64
65
66
# File 'lib/radiant/admin_ui.rb', line 64

def url
  @url
end

Instance Method Details

#relative_urlObject



75
76
77
# File 'lib/radiant/admin_ui.rb', line 75

def relative_url
  File.join(ActionController::Base.relative_url_root || '', url)
end

#visible?(user) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/radiant/admin_ui.rb', line 71

def visible?(user)
  tab.visible?(user) && visible_by_controller?(user)
end