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: {
      color: "#7FCDBB",
      weight: 1,
      radius: 4,
      sr_color_name: "Green"
    },
    UNAVAILABLE: {
      weight: 1,
      radius: 4,
      color: "#EDF8B1",
      sr_color_name: "Yellow"
    },
    SELECTED: {
      weight: 1,
      radius: 4,
      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.



47
48
49
50
51
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 47

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.



7
8
9
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 7

def bounds_overlay
  @bounds_overlay
end

#controlsObject

Returns the value of attribute controls.



7
8
9
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 7

def controls
  @controls
end

#layersObject

Returns the value of attribute layers.



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

def layers
  @layers
end

#sleepObject

Returns the value of attribute sleep.



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

def sleep
  @sleep
end

Instance Method Details

#to_hObject



61
62
63
64
65
66
67
68
69
70
# File 'lib/geoblacklight/configuration/leaflet_config.rb', line 61

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