Class: Atrium::Exhibit

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
IsShowcasedMixin, QueryParamMixin
Defined in:
app/models/atrium/exhibit.rb

Overview

An Atrium::Exhibit is a customizable view of a single topic (as defined by a facet), further scoped by an optional Solr query. An Atrium::Exhibit defines it’s own hierarchical list of facets. An Atrium::Exhibit may also have a description and a list of featured items.

Instance Method Summary collapse

Instance Method Details

#browse_facet_namesObject



30
31
32
# File 'app/models/atrium/exhibit.rb', line 30

def browse_facet_names
  browse_levels.collect {|facet| facet.solr_facet_name} rescue []
end

#facet_orderObject



34
35
36
37
38
# File 'app/models/atrium/exhibit.rb', line 34

def facet_order
  facet_order = {}
  browse_levels.map{|facet| facet_order[facet[:id]] = facet.level_number }
  facet_order
end

#facet_order=(facet_order = {}) ⇒ Object



40
41
42
43
44
45
46
47
# File 'app/models/atrium/exhibit.rb', line 40

def facet_order=(facet_order = {})
  valid_ids = browse_levels.select(:id).map{|facet| facet[:id]}
  facet_order.each_pair do |id, order|
    if valid_ids.include?(id.to_i)
      Atrium::BrowseLevel.find(id).update_attributes!(level_number: order)
    end
  end
end

#get_available_facetsObject



55
56
57
# File 'app/models/atrium/exhibit.rb', line 55

def get_available_facets
  collection.search_facet_names - browse_facet_names
end

#pretty_titleObject



51
52
53
# File 'app/models/atrium/exhibit.rb', line 51

def pretty_title
  label.blank? ? "Exhibit #{set_number}" : label
end