Class: AppKit::NavigationItem

Inherits:
Object
  • Object
show all
Defined in:
lib/app_kit/navigation_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNavigationItem

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

#controllerObject

Returns the value of attribute controller.



2
3
4
# File 'lib/app_kit/navigation_item.rb', line 2

def controller
  @controller
end

#iconObject



17
18
19
20
21
22
23
# File 'lib/app_kit/navigation_item.rb', line 17

def icon
  if has_resource?
    resource.navigation_icon
  else
    @icon
  end
end

#path_helperObject

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

#positionObject

Returns the value of attribute position.



2
3
4
# File 'lib/app_kit/navigation_item.rb', line 2

def position
  @position
end

#resourceObject

Returns the value of attribute resource.



2
3
4
# File 'lib/app_kit/navigation_item.rb', line 2

def resource
  @resource
end

#titleObject

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_pathObject



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

Returns:

  • (Boolean)


25
26
27
# File 'lib/app_kit/navigation_item.rb', line 25

def has_resource?
  resource != nil
end