Class: Blacklight::Gallery::OpenseadragonEmbedComponent
- Inherits:
-
Component
- Object
- Component
- Blacklight::Gallery::OpenseadragonEmbedComponent
- Defined in:
- app/components/blacklight/gallery/openseadragon_embed_component.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
readonly
Returns the value of attribute classes.
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#presenter ⇒ Object
readonly
Returns the value of attribute presenter.
Instance Method Summary collapse
- #count ⇒ Object
- #id_prefix ⇒ Object
- #image ⇒ Object
-
#initialize(document:, presenter:, view_config: nil, classes: [], **kwargs) ⇒ OpenseadragonEmbedComponent
constructor
A new instance of OpenseadragonEmbedComponent.
- #osd_config ⇒ Object
- #osd_config_referencestrip ⇒ Object
- #render? ⇒ Boolean
- #view_config ⇒ Object
Constructor Details
#initialize(document:, presenter:, view_config: nil, classes: [], **kwargs) ⇒ OpenseadragonEmbedComponent
Returns a new instance of OpenseadragonEmbedComponent.
8 9 10 11 12 13 14 15 16 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 8 def initialize(document:, presenter:, view_config: nil, classes: [], **kwargs) super @document = document @presenter = presenter @view_config = view_config @classes = classes @id_prefix = id_prefix end |
Instance Attribute Details
#classes ⇒ Object (readonly)
Returns the value of attribute classes.
6 7 8 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 6 def classes @classes end |
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 6 def document @document end |
#presenter ⇒ Object (readonly)
Returns the value of attribute presenter.
6 7 8 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 6 def presenter @presenter end |
Instance Method Details
#count ⇒ Object
22 23 24 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 22 def count Array(image).length end |
#id_prefix ⇒ Object
55 56 57 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 55 def id_prefix "osd-#{Blacklight::OpenseadragonHelper.mint_id}".to_param end |
#image ⇒ Object
18 19 20 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 18 def image @image ||= document.to_openseadragon(view_config) end |
#osd_config ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 34 def osd_config { crossOriginPolicy: false, zoomInButton: "#{@id_prefix}-zoom-in", zoomOutButton: "#{@id_prefix}-zoom-out", homeButton: "#{@id_prefix}-home", fullPageButton: "#{@id_prefix}-full-page", nextButton: "#{@id_prefix}-next", previousButton: "#{@id_prefix}-previous" } end |
#osd_config_referencestrip ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 46 def osd_config_referencestrip { showReferenceStrip: true, sequenceMode: true, referenceStripScroll: 'vertical', referenceStripBackgroundColor: 'transparent' } end |
#render? ⇒ Boolean
30 31 32 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 30 def render? !image.nil? end |
#view_config ⇒ Object
26 27 28 |
# File 'app/components/blacklight/gallery/openseadragon_embed_component.rb', line 26 def view_config @view_config || presenter.view_config end |