Sha256: 518ee59bcfeb16257d34dfe54c60c43a1739b32c26368fc4ff37171605afafb0
Contents?: true
Size: 947 Bytes
Versions: 13
Compression:
Stored size: 947 Bytes
Contents
module AmaLayout class Navigation include ActiveModel::Model include Draper::Decoratable attr_accessor :user, :current_url, :nav_file_path def initialize(args = {}) args = defaults.merge args super end 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 YAML.load ERB.new(File.read nav_file_path).result end def defaults { nav_file_path: File.join(Gem.loaded_specs["ama_layout"].full_gem_path, "lib", "ama_layout", "navigation.yml") } end end end
Version data entries
13 entries across 13 versions & 1 rubygems