Class: AppKit::NavigationItem
- Inherits:
-
Object
- Object
- AppKit::NavigationItem
- Defined in:
- lib/app_kit/navigation_item.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
- #icon ⇒ Object
-
#path_helper ⇒ Object
Returns the value of attribute path_helper.
-
#position ⇒ Object
Returns the value of attribute position.
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #get_path ⇒ Object
- #has_resource? ⇒ Boolean
-
#initialize ⇒ NavigationItem
constructor
A new instance of NavigationItem.
Constructor Details
#initialize ⇒ NavigationItem
Returns a new instance of NavigationItem.
5 6 7 |
# File 'lib/app_kit/navigation_item.rb', line 5 def initialize @position = :left end |
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
2 3 4 |
# File 'lib/app_kit/navigation_item.rb', line 2 def controller @controller end |
#icon ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/app_kit/navigation_item.rb', line 17 def icon if has_resource? resource. else @icon end end |
#path_helper ⇒ Object
Returns the value of attribute path_helper.
2 3 4 |
# File 'lib/app_kit/navigation_item.rb', line 2 def path_helper @path_helper end |
#position ⇒ Object
Returns the value of attribute position.
2 3 4 |
# File 'lib/app_kit/navigation_item.rb', line 2 def position @position end |
#resource ⇒ Object
Returns the value of attribute resource.
2 3 4 |
# File 'lib/app_kit/navigation_item.rb', line 2 def resource @resource end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/app_kit/navigation_item.rb', line 2 def title @title end |
Instance Method Details
#get_path ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/app_kit/navigation_item.rb', line 9 def get_path if has_resource? polymorphic_path([app_kit, resource]) else main_app.send(path_helper) end end |
#has_resource? ⇒ Boolean
25 26 27 |
# File 'lib/app_kit/navigation_item.rb', line 25 def has_resource? resource != nil end |