Class: AmaLayout::NavigationDecorator
- Inherits:
-
Draper::Decorator
- Object
- Draper::Decorator
- AmaLayout::NavigationDecorator
- Defined in:
- lib/ama_layout/decorators/navigation_decorator.rb
Instance Method Summary collapse
- #account_toggle ⇒ Object
- #display_name_text ⇒ Object
- #items ⇒ Object
- #name_or_email ⇒ Object
- #sidebar ⇒ Object
- #sign_out_link ⇒ Object
- #top_nav ⇒ Object
Instance Method Details
#account_toggle ⇒ Object
32 33 34 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 32 def account_toggle h.render partial: "account_toggle" end |
#display_name_text ⇒ Object
9 10 11 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 9 def display_name_text name_or_email.truncate(30) end |
#items ⇒ Object
5 6 7 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 5 def items object.items.map { |i| i.decorate } end |
#name_or_email ⇒ Object
28 29 30 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 28 def name_or_email display_name.present? ? "Welcome, #{display_name.titleize}" : email end |
#sidebar ⇒ Object
24 25 26 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 24 def h.render partial: "ama_layout/sidebar", locals: { navigation: self } if items.any? end |
#sign_out_link ⇒ Object
13 14 15 16 17 18 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 13 def sign_out_link return "" unless user h.content_tag :li, class: "side-nav__item" do h.concat h.link_to "Sign Out", "/logout", class: "side-nav__link" end end |
#top_nav ⇒ Object
20 21 22 |
# File 'lib/ama_layout/decorators/navigation_decorator.rb', line 20 def top_nav h.render partial: "ama_layout/top_nav", locals: { navigation: self } if items.any? end |