Class: Fae::Navigation
- Inherits:
-
Object
- Object
- Fae::Navigation
- Includes:
- NavigationConcern
- Defined in:
- app/models/fae/navigation.rb
Instance Attribute Summary collapse
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
-
#current_path ⇒ Object
Returns the value of attribute current_path.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
-
#initialize(current_user) ⇒ Navigation
constructor
A new instance of Navigation.
- #search(query) ⇒ Object
- #side_nav(current_path) ⇒ Object
Methods included from NavigationConcern
Constructor Details
#initialize(current_user) ⇒ Navigation
Returns a new instance of Navigation.
8 9 10 11 |
# File 'app/models/fae/navigation.rb', line 8 def initialize(current_user) @current_user = current_user @items = (structure) end |
Instance Attribute Details
#coordinates ⇒ Object
Returns the value of attribute coordinates.
6 7 8 |
# File 'app/models/fae/navigation.rb', line 6 def coordinates @coordinates end |
#current_path ⇒ Object
Returns the value of attribute current_path.
6 7 8 |
# File 'app/models/fae/navigation.rb', line 6 def current_path @current_path end |
#current_user ⇒ Object
Returns the value of attribute current_user.
6 7 8 |
# File 'app/models/fae/navigation.rb', line 6 def current_user @current_user end |
#items ⇒ Object
Returns the value of attribute items.
6 7 8 |
# File 'app/models/fae/navigation.rb', line 6 def items @items end |
Instance Method Details
#search(query) ⇒ Object
22 23 24 |
# File 'app/models/fae/navigation.rb', line 22 def search(query) find_items_by_text(@items, query, []) end |
#side_nav(current_path) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/models/fae/navigation.rb', line 13 def side_nav(current_path) @current_path = current_path # set the coors based on current path @coordinates = [] find_current_hash(@items) @items[@coordinates.first][:subitems][@coordinates.second][:subitems] if @coordinates.length > 2 end |