Sha256: 381038ac7ad84feb2c2397965beecb2feba63fef8b7c6d18e6318945fd91c30f

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 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  }

    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

4 entries across 4 versions & 1 rubygems

Version Path
blacklight-spotlight-0.3.1 app/models/spotlight/main_navigation.rb
blacklight-spotlight-0.3.0 app/models/spotlight/main_navigation.rb
blacklight-spotlight-0.2.0 app/models/spotlight/main_navigation.rb
blacklight-spotlight-0.1.0 app/models/spotlight/main_navigation.rb