Class: Geoblacklight::StaticMapComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Geoblacklight::StaticMapComponent
- Defined in:
- app/components/geoblacklight/static_map_component.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(document:) ⇒ StaticMapComponent
constructor
A new instance of StaticMapComponent.
- #render? ⇒ Boolean
- #viewer_tag ⇒ Object
Constructor Details
#initialize(document:) ⇒ StaticMapComponent
Returns a new instance of StaticMapComponent.
7 8 9 10 |
# File 'app/components/geoblacklight/static_map_component.rb', line 7 def initialize(document:, **) @document = document super() end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'app/components/geoblacklight/static_map_component.rb', line 5 def document @document end |
Instance Method Details
#before_render ⇒ Object
16 17 18 |
# File 'app/components/geoblacklight/static_map_component.rb', line 16 def before_render @label ||= t("geoblacklight.location") end |
#render? ⇒ Boolean
12 13 14 |
# File 'app/components/geoblacklight/static_map_component.rb', line 12 def render? Settings.SIDEBAR_STATIC_MAP&.any? { |vp| @document.viewer_protocol == vp } end |
#viewer_tag ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/geoblacklight/static_map_component.rb', line 20 def viewer_tag = helpers..deep_dup .SLEEP.SLEEP = false tag.div(nil, id: "static-map", data: { "controller" => "leaflet-viewer", "leaflet-viewer-basemap-value" => helpers.geoblacklight_basemap, "leaflet-viewer-page-value" => "STATIC_MAP", "leaflet-viewer-map-geom-value" => @document.geometry.geojson, "leaflet-viewer-options-value" => , "leaflet-viewer-draw-initial-bounds-value" => true }) end |