Sha256: 3c8df1c7d9fade71e247723a6d9558daad3b46142e3ac869b8fe4b2a12ea0815

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 Bytes

Contents

module Spotlight
  class MainNavigation < ActiveRecord::Base
    belongs_to :exhibit, touch: true
    default_scope  -> { order("weight ASC") }
    scope :browse, -> { where(nav_type: "browse").take }
    scope :about,  -> { where(nav_type: "about").take  }
    scope :displayable, -> { where(display: true) }

    def label_or_default
      if label.present?
        label
      else
        default_label
      end
    end

    def default_label
      I18n.t(:"spotlight.main_navigation.#{nav_type}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blacklight-spotlight-0.4.1 app/models/spotlight/main_navigation.rb