Sha256: 47444972b83fd47bfd7b2b99c83878285a7d4151bd50fa7ea9fa7fbe03afb4aa

Contents?: true

Size: 840 Bytes

Versions: 7

Compression:

Stored size: 840 Bytes

Contents

# frozen_string_literal: true

module AmaLayout
  module Agent
    class NavigationDecorator
      include AmaLayout::DraperReplacement

      def items
        object.items.map(&:decorate)
      end

      def display_name_text
        "Welcome, #{display_name.titleize}#{cash_drawer_name}"
      end

      def sign_out_link
        return '' unless user

        h.render partial: ama_layout_partial('sign_out_link')
      end

      def top_nav
        return '' unless user

        h.render partial: ama_layout_partial('agent/top_nav'), locals: { navigation: self }
      end

      def sidebar
        return '' unless user

        h.render partial: ('sidebar'), locals: { navigation: self }
      end

      def cash_drawer_name
        user.cash_drawers.any? ? " - #{user.cash_drawers.last.name}" : ''
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ama_layout-11.5.1 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.5.0 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.4.0 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.3.1 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.3.0 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.2.0 lib/ama_layout/decorators/agent/navigation_decorator.rb
ama_layout-11.1.0 lib/ama_layout/decorators/agent/navigation_decorator.rb