Class: TrustyCms::AdminUI::NavSubItem

Inherits:
Object
  • Object
show all
Defined in:
lib/trusty_cms/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, url = '#') ⇒ NavSubItem

Returns a new instance of NavSubItem.



83
84
85
86
# File 'lib/trusty_cms/admin_ui.rb', line 83

def initialize(name, url = '#')
  @name = name
  @url = url
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



80
81
82
# File 'lib/trusty_cms/admin_ui.rb', line 80

def name
  @name
end

#tabObject

Returns the value of attribute tab.



81
82
83
# File 'lib/trusty_cms/admin_ui.rb', line 81

def tab
  @tab
end

#urlObject (readonly)

Returns the value of attribute url.



80
81
82
# File 'lib/trusty_cms/admin_ui.rb', line 80

def url
  @url
end

Instance Method Details

#relative_urlObject



92
93
94
# File 'lib/trusty_cms/admin_ui.rb', line 92

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

#visible?(user) ⇒ Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/trusty_cms/admin_ui.rb', line 88

def visible?(user)
  visible_by_controller?(user)
end