Sha256: 3fac0b533dbb09c3d1e9a5c5e6f31a3603cf453d1f46fcb73853b540fbf64a24

Contents?: true

Size: 785 Bytes

Versions: 44

Compression:

Stored size: 785 Bytes

Contents

module AmaLayout
  class Navigation
    include ActiveModel::Model
    include Draper::Decoratable

    attr_accessor :user, :current_url

    cattr_accessor :member do
      "member"
    end
    cattr_accessor :non_member do
      "non-member"
    end
    cattr_accessor :member_in_renewal do
      "member-in-renewal"
    end
    cattr_accessor :member_in_renewal_late do
      "member-in-renewal-late"
    end

    def items
      navigation_items.fetch(user.try(:navigation), []).map do |n|
        NavigationItem.new n.merge({ current_url: current_url})
      end
    end

  private
    def navigation_items
      file = File.join Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "navigation.yml"
      YAML.load ERB.new(File.read file).result
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ama_layout-2.5.0 lib/ama_layout/navigation.rb
ama_layout-2.4.5 lib/ama_layout/navigation.rb
ama_layout-2.4.4 lib/ama_layout/navigation.rb
ama_layout-2.4.3 lib/ama_layout/navigation.rb
ama_layout-2.4.2 lib/ama_layout/navigation.rb
ama_layout-2.4.1 lib/ama_layout/navigation.rb
ama_layout-2.4.0 lib/ama_layout/navigation.rb
ama_layout-2.3.4 lib/ama_layout/navigation.rb
ama_layout-2.3.3 lib/ama_layout/navigation.rb
ama_layout-2.3.2 lib/ama_layout/navigation.rb
ama_layout-2.3.1 lib/ama_layout/navigation.rb
ama_layout-2.3.0 lib/ama_layout/navigation.rb
ama_layout-2.2.13 lib/ama_layout/navigation.rb
ama_layout-2.2.12 lib/ama_layout/navigation.rb
ama_layout-2.2.11 lib/ama_layout/navigation.rb
ama_layout-2.2.10 lib/ama_layout/navigation.rb
ama_layout-2.2.9 lib/ama_layout/navigation.rb
ama_layout-2.2.8 lib/ama_layout/navigation.rb
ama_layout-2.2.7 lib/ama_layout/navigation.rb
ama_layout-2.2.6 lib/ama_layout/navigation.rb