Sha256: dc923ce197b82131c23d79a56d20f7bdf020ac2bc925321fade044e3af150d41
Contents?: true
Size: 855 Bytes
Versions: 18
Compression:
Stored size: 855 Bytes
Contents
module Spotlight ## # Exhibit navbar links class MainNavigation < ActiveRecord::Base include Spotlight::Translatables belongs_to :exhibit, touch: true default_scope { order('weight ASC') } scope :browse, -> { find_by(nav_type: 'browse') } scope :about, -> { find_by(nav_type: 'about') } scope :curated_features, -> { find_by(nav_type: 'curated_features') } scope :displayable, -> { where(display: true) } translates :label def displayable? display? end def label_or_default if label.present? label else default_label end end def default_label I18n.t(:"spotlight.main_navigation.#{nav_type}") end private ## # Allows us to scope translations namespace. def slug ['main_navigation', nav_type].join('.') end end end
Version data entries
18 entries across 18 versions & 1 rubygems