Sha256: f297ac80ff1a79f98991eb8fff8a9715f669066238f954a450956dfbf8a0ea0e

Contents?: true

Size: 826 Bytes

Versions: 28

Compression:

Stored size: 826 Bytes

Contents

module AmaLayout
  class NavigationDecorator < Draper::Decorator
    delegate_all

    def items
      object.items.map { |i| i.decorate }
    end

    def display_name_text
      name_or_email.truncate(30)
    end

    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

    def top_nav
      h.render partial: "ama_layout/top_nav", locals: { navigation: self } if items.any?
    end

    def sidebar
      h.render partial: "ama_layout/sidebar", locals: { navigation: self } if items.any?
    end

    def name_or_email
      display_name.present? ? "Welcome, #{display_name.titleize}" : email
    end

    def account_toggle
      h.render partial: "account_toggle"
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ama_layout-5.6.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.5.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.4.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-6.3.0.pre lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.2.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.1.1 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.1.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.0.2 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.0.1 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-5.0.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.10.1 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.10.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.9.0 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.7 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.6 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.5 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.4 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.3 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.2 lib/ama_layout/decorators/navigation_decorator.rb
ama_layout-4.8.1 lib/ama_layout/decorators/navigation_decorator.rb