Class: UWDC::Display
- Inherits:
-
Object
- Object
- UWDC::Display
- Defined in:
- lib/uwdc/display.rb
Overview
Public: Return an object to drive the display of UWDC items
Example
# => object
Instance Attribute Summary collapse
-
#mets ⇒ Object
Returns the value of attribute mets.
-
#title ⇒ Object
Returns the value of attribute title.
-
#visual_representation ⇒ Object
Returns the value of attribute visual_representation.
Class Method Summary collapse
Instance Method Summary collapse
- #audio ⇒ Object
- #files ⇒ Object
- #images ⇒ Object
-
#initialize(id, xml = nil) ⇒ Display
constructor
A new instance of Display.
- #models ⇒ Object
- #mods ⇒ Object (also: #metadata)
-
#partials ⇒ Object
@TODO: Public: Partials is the intersection of the struct_map and the object cmodels Need to preserve the struct map’s “div” structure But also tease out which objects are displayable via which partials.
- #video ⇒ Object
Constructor Details
Instance Attribute Details
#mets ⇒ Object
Returns the value of attribute mets.
10 11 12 |
# File 'lib/uwdc/display.rb', line 10 def mets @mets end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/uwdc/display.rb', line 10 def title @title end |
#visual_representation ⇒ Object
Returns the value of attribute visual_representation.
10 11 12 |
# File 'lib/uwdc/display.rb', line 10 def visual_representation @visual_representation end |
Class Method Details
.cmodels ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/uwdc/display.rb', line 28 def self.cmodels { "info:fedora/1711.dl:CModelAudio" => { :view => true, :partial => "audio" }, "info:fedora/1711.dl:CModelAudioStream" => { :view => true, :partial => "audio" }, "info:fedora/1711.dl:CModelCompositeObject" => { :view => true, :partial => "set" }, "info:fedora/1711.dl:CModelCollection" => { :view => true, :partial => "collection" }, "info:fedora/1711.dl:CModelCompositeObject" => { :view => false, :partial => nil }, "info:fedora/1711.dl:CModelCompositeSequenceObject" => { :view => true, :partial => "image-with-sequence" }, "info:fedora/1711.dl:CModelFirstClassObject" => { :view => false, :partial => nil }, "info:fedora/1711.dl:CModelImageWithDefaultRes" => { :view => true, :partial => "image" }, "info:fedora/1711.dl:CModelImageWithDetail" => { :view => true, :partial => "image-with-detail" }, "info:fedora/1711.dl:CModelImageWithSequence" => { :view => true, :partial => "image-with-sequence" }, "info:fedora/1711.dl:CModelImageWithXLarge" => { :view => true, :partial => "image-with-xlarge" }, "info:fedora/1711.dl:CModelImageWithZoom" => { :view => true, :partial => "image-with-zoom" }, "info:fedora/1711.dl:CModelSimpleDocument" => { :view => true, :partial => "download" }, "info:fedora/1711.dl:CModelUWDCObject" => { :view => false, :partial => nil } } end |
.use ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/uwdc/display.rb', line 16 def self.use { "title" => { :view => false, :partial => "text" }, "visualrepresentation" => { :view => false, :partial => "text" }, "icon" => { :view => true, :partial => "image" }, "thumb" => { :view => true, :partial => "image" }, "reference" => { :view => true, :partial => "image" }, "large" => { :view => true, :partial => "image" }, "audiostream" => { :view => true, :partial => "audio" } } end |
Instance Method Details
#audio ⇒ Object
61 62 63 64 65 66 |
# File 'lib/uwdc/display.rb', line 61 def audio viewable_models.inject({}) do |result, model| result[model] = select_files(model, "audio") unless select_files(model, "audio").empty? result end end |
#files ⇒ Object
47 48 49 |
# File 'lib/uwdc/display.rb', line 47 def files @mets.file_sec.files end |
#images ⇒ Object
51 52 53 54 55 56 |
# File 'lib/uwdc/display.rb', line 51 def images viewable_models.inject({}) do |result, model| result[model] = select_files(model, "image") unless select_files(model, "image").empty? result end end |
#models ⇒ Object
82 83 84 |
# File 'lib/uwdc/display.rb', line 82 def models @mets.rels_ext.models end |
#mods ⇒ Object Also known as: metadata
68 69 70 |
# File 'lib/uwdc/display.rb', line 68 def mods @mets.mods end |
#partials ⇒ Object
@TODO: Public: Partials is the intersection of the struct_map and the object cmodels Need to preserve the struct map’s “div” structure But also tease out which objects are displayable via which partials
Return an array of Hashes (possibly nested) of ids keying to view partials
78 79 80 |
# File 'lib/uwdc/display.rb', line 78 def partials @mets.struct_map.structure end |
#video ⇒ Object
58 59 |
# File 'lib/uwdc/display.rb', line 58 def video end |