Class: Decidim::Map::Frontend

Inherits:
Utility
  • Object
show all
Defined in:
lib/decidim/map/frontend.rb

Overview

A base class for front-end mapping functionality, common to all front-end map services, such as dynamic_map.rb and autocomplete.rb. Provides builder classes for the front-end.

Direct Known Subclasses

Autocomplete, DynamicMap

Defined Under Namespace

Classes: Builder

Instance Attribute Summary

Attributes inherited from Utility

#configuration, #locale, #organization

Instance Method Summary collapse

Methods inherited from Utility

#initialize

Constructor Details

This class inherits a constructor from Decidim::Map::Utility

Instance Method Details

#builder_classClass

Returns the builder class for the map. Allows fetching the class name dynamically also in the utility classes that extend this class.

Returns:

  • (Class)

    The class for the builder object.



24
25
26
# File 'lib/decidim/map/frontend.rb', line 24

def builder_class
  self.class.const_get(:Builder)
end

#builder_optionsHash

Returns the default options for the builder object.

Returns:

  • (Hash)

    The default options for the map builder.



31
32
33
# File 'lib/decidim/map/frontend.rb', line 31

def builder_options
  configuration
end

#create_builder(template, options = {}) ⇒ Decidim::Map::BuilderUtility::Builder

Creates a builder class for the front-end that is used to build the HTML markup related to this utility.

Returns:

  • (Decidim::Map::BuilderUtility::Builder)

    The builder object that can be used to build the map’s markup.



16
17
18
# File 'lib/decidim/map/frontend.rb', line 16

def create_builder(template, options = {})
  builder_class.new(template, builder_options.merge(options))
end