Class: Geoblacklight::Configuration::LeafletConfig
- Inherits:
-
Object
- Object
- Geoblacklight::Configuration::LeafletConfig
- Includes:
- ActiveModel::Attributes, ActiveModel::Model
- Defined in:
- lib/geoblacklight/configuration/leaflet_config.rb
Constant Summary collapse
- DEFAULT_SLEEP_CONFIG =
{ sleep: true, # set to false to disable margin_distance: 100, # set to zero / false if you want to disable this check sleeptime: 750, waketime: 750, hovertowake: false, background: "rgba(214, 214, 214, .7)" }.freeze
Instance Attribute Summary collapse
-
#bounds_overlay ⇒ Object
Returns the value of attribute bounds_overlay.
-
#controls ⇒ Object
Returns the value of attribute controls.
-
#layers ⇒ Object
Returns the value of attribute layers.
-
#sleep ⇒ Object
Returns the value of attribute sleep.
Class Method Summary collapse
-
.default_layers_config ⇒ Object
Built lazily (rather than as a frozen constant) so the sr_color_name values pick up the current I18n locale each time a config is built.
Instance Method Summary collapse
-
#initialize ⇒ LeafletConfig
constructor
A new instance of LeafletConfig.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ LeafletConfig
Returns a new instance of LeafletConfig.
46 47 48 49 50 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 46 def initialize super @sleep = LeafletSleepConfig.new(DEFAULT_SLEEP_CONFIG) @layers = LeafletLayersConfig.new(self.class.default_layers_config) end |
Instance Attribute Details
#bounds_overlay ⇒ Object
Returns the value of attribute bounds_overlay.
9 10 11 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 9 def @bounds_overlay end |
#controls ⇒ Object
Returns the value of attribute controls.
9 10 11 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 9 def controls @controls end |
#layers ⇒ Object
Returns the value of attribute layers.
11 12 13 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 11 def layers @layers end |
#sleep ⇒ Object
Returns the value of attribute sleep.
11 12 13 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 11 def sleep @sleep end |
Class Method Details
.default_layers_config ⇒ Object
Built lazily (rather than as a frozen constant) so the sr_color_name values pick up the current I18n locale each time a config is built.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 27 def self.default_layers_config { index: { DEFAULT: LayerConfig.new( color: "#7FCDBB", sr_color_name: I18n.t("geoblacklight.map.legend.colors.default") ), UNAVAILABLE: LayerConfig.new( color: "#EDF8B1", sr_color_name: I18n.t("geoblacklight.map.legend.colors.unavailable") ), SELECTED: LayerConfig.new( color: "#2C7FB8", sr_color_name: I18n.t("geoblacklight.map.legend.colors.selected") ) } } end |
Instance Method Details
#to_h ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 60 def to_h { bounds_overlay: , selected_color: selected_color, sleep: sleep.to_h, sidebar: , layers: layers.to_h, controls: controls }.compact end |