Sha256: 81cb6889db91c62a7fe1a5f10394cfb0e18896eca4df1646ec76ff4afab18157

Contents?: true

Size: 1.37 KB

Versions: 14

Compression:

Stored size: 1.37 KB

Contents

((exports) => {
  exports.Decidim = exports.Decidim || {};

  const MapController = exports.Decidim.MapController;
  const openLink = exports.open;

  class MapStaticController extends MapController {
    start() {
      this.map.removeControl(this.map.zoomControl);
      this.map.dragging.disable();
      this.map.touchZoom.disable();
      this.map.doubleClickZoom.disable();
      this.map.scrollWheelZoom.disable();
      this.map.boxZoom.disable();
      this.map.keyboard.disable();
      if (this.map.tap) {
        this.map.tap.disable();
      }

      if (this.config.latitude && this.config.longitude) {
        const coordinates = [this.config.latitude, this.config.longitude];

        this.map.panTo(coordinates);
        const marker = L.marker(coordinates, {
          icon: this.createIcon(),
          keyboard: true,
          title: this.config.title
        }).addTo(this.map);
        marker._icon.removeAttribute("tabindex");
      }
      if (this.config.zoom) {
        this.map.setZoom(this.config.zoom);
      } else {
        this.map.setZoom(15);
      }

      if (this.config.link) {
        this.map._container.addEventListener("click", (ev) => {
          ev.preventDefault();
          this.map._container.focus();
          openLink(this.config.link, "_blank");
        });
      }
    }
  }

  exports.Decidim.MapStaticController = MapStaticController;
})(window);

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
decidim-core-0.24.3 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.6 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.24.2 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.5 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.24.1 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.24.0 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.24.0.rc2 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.4 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.24.0.rc1 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.3 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.2 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.1 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.1.rc1 app/assets/javascripts/decidim/map/controller/static.es6
decidim-core-0.23.0 app/assets/javascripts/decidim/map/controller/static.es6