Class: Geoblacklight::Configuration::LeafletConfig

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Attributes, ActiveModel::Model
Defined in:
lib/geoblacklight/configuration/leaflet_config.rb

Constant Summary collapse

DEFAULT_LAYERS_CONFIG =
{
  index: {
    DEFAULT: LayerConfig.new(
      color: "#7FCDBB",
      sr_color_name: "Green"
    ),
    UNAVAILABLE: LayerConfig.new(
      color: "#EDF8B1",
      sr_color_name: "Yellow"
    ),
    SELECTED: LayerConfig.new(
      color: "#2C7FB8",
      sr_color_name: "Blue"
    )
  }
}.freeze
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,
  message: "Click to Wake",
  background: "rgba(214, 214, 214, .7)"
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLeafletConfig

Returns a new instance of LeafletConfig.



43
44
45
46
47
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 43

def initialize
  super
  @sleep = LeafletSleepConfig.new(DEFAULT_SLEEP_CONFIG)
  @layers = LeafletLayersConfig.new(DEFAULT_LAYERS_CONFIG)
end

Instance Attribute Details

#bounds_overlayObject

Returns the value of attribute bounds_overlay.



9
10
11
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 9

def bounds_overlay
  @bounds_overlay
end

#controlsObject

Returns the value of attribute controls.



9
10
11
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 9

def controls
  @controls
end

#layersObject

Returns the value of attribute layers.



11
12
13
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 11

def layers
  @layers
end

#sleepObject

Returns the value of attribute sleep.



11
12
13
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 11

def sleep
  @sleep
end

Instance Method Details

#to_hObject



57
58
59
60
61
62
63
64
65
66
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 57

def to_h
  {
    bounds_overlay: bounds_overlay,
    selected_color: selected_color,
    sleep: sleep.to_h,
    sidebar: sidebar,
    layers: layers.to_h,
    controls: controls
  }.compact
end