Compare commits

..

9 Commits
3.1.7 ... 3.2.2

Author SHA1 Message Date
David Molineus
60e285c673 Generate absolute urls for file layers
https://github.com/netzmacht/contao-leaflet-maps/issues/92
2020-12-18 09:13:29 +01:00
David Molineus
49f3b7dbcd Remove template debug placeholders (#93) 2020-12-18 08:55:28 +01:00
David Molineus
89d83ab8e0 Merge pull request #95 from netzmacht/dependabot/npm_and_yarn/ini-1.3.7
Bump ini from 1.3.5 to 1.3.7
2020-12-18 08:55:15 +01:00
dependabot[bot]
141bb0f7b1 Bump ini from 1.3.5 to 1.3.7
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 23:52:13 +00:00
David Molineus
457bb612ef Update changelog 2020-09-02 07:42:33 +02:00
David Molineus
118bb9a829 Do not append javascript at the body but inject them in the element/module
Consent tools might interrupt the rendering
2020-09-02 07:40:44 +02:00
David Molineus
e49c74c546 Merge tag '3.2.0' into master 2020-08-28 17:19:23 +02:00
David Molineus
6054def7aa Prepare release 2020-08-28 17:19:04 +02:00
David Molineus
86026a473b Add support for hofff/contao-consent-bridge #81 2020-08-28 17:14:33 +02:00
11 changed files with 102 additions and 21 deletions

View File

@@ -8,6 +8,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Remove template debug placeholders, it breaks generated javascript ([#93](https://github.com/netzmacht/contao-leaflet-maps/issues/93))
- Generate absolute urls for file layers ([#92](https://github.com/netzmacht/contao-leaflet-maps/issues/92))
## [3.2.1] - 2020-09-02
### Fixed
- Do not append javascript to the body anymore as consent tools might interrupt rendering
## [3.2.0] - 2020-08-28
### Added
- Add support for consent tools based on `hofff/contao-consent-bridge`
## [3.1.7] - 2020-08-28
### Fixed
@@ -151,7 +168,9 @@ Implemented enhancements
- Bypass filesystem cache in debug mode
- Changelog added
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.7...hotfix/3.1.8
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.1...hotfix/3.2.2
[3.2.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.7...3.2.0
[3.1.7]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.6...3.1.7
[3.1.6]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.5...3.1.6
[3.1.5]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.4...3.1.5

View File

@@ -42,12 +42,16 @@
},
"require-dev": {
"contao/manager-plugin": "^2.1",
"hofff/contao-consent-bridge": "^1.0",
"phpcq/all-tasks": "^1.2"
},
"conflict": {
"hofff/contao-consent-bridge": "<1.0 || >= 2.0"
},
"extra": {
"branch-alias": {
"dev-master": "3.1.x-dev",
"dev-develop": "3.2.x-dev",
"dev-master": "3.2.x-dev",
"dev-develop": "3.3.x-dev",
"dev-support/2.x": "2.0.x-dev"
},
"contao": {

6
package-lock.json generated
View File

@@ -1278,9 +1278,9 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ=="
},
"interpret": {
"version": "1.4.0",

View File

@@ -0,0 +1,37 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Bundle\ConsentBridge;
use Hofff\Contao\Consent\Bridge\Bridge;
use Hofff\Contao\Consent\Bridge\Plugin as ConsentBridgePlugin;
use Hofff\Contao\Consent\Bridge\Render\RenderInformation;
/**
* Consent Bridge plugin for leaflet.
*/
final class Plugin implements ConsentBridgePlugin
{
/**
* {@inheritDoc}
*/
public function load(Bridge $bridge): void
{
$renderInformation = RenderInformation::autoRenderWithPlaceholder('leaflet_consent_bridge_placeholder');
$bridge
->supportContentElement('leaflet', $renderInformation)
->supportFrontendModule('leaflet', $renderInformation);
}
}

View File

@@ -77,6 +77,7 @@ services:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
arguments:
- '@netzmacht.contao_toolkit.repository_manager'
- '@netzmacht.contao_toolkit.contao.environment_adapter'
tags:
- { name: netzmacht.contao_leaflet.mapper }

View File

@@ -138,3 +138,7 @@ services:
arguments:
- '@twig'
- '%kernel.project_dir%'
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
tags:
- { name: hofff_contao_consent_bridge.plugin }

View File

@@ -9,5 +9,5 @@
</div>
<!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
<script><?= $this->javascript ?></script>

View File

@@ -9,4 +9,4 @@
</div>
<!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
<script><?= $this->javascript ?></script>

View File

@@ -385,11 +385,15 @@ class MapProvider
];
$content = $this->templateEngine->render($templateReference, $parameters);
$event = new GetJavascriptEvent($definition, $content);
$content = preg_replace(
['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
'',
$content
);
$event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event::NAME, $event);
$buffer = $event->getJavascript();
return $buffer;
return $event->getJavascript();
}
}

View File

@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\CoreBundle\Framework\Adapter;
use Contao\Environment;
use Contao\FilesModel;
use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
@@ -58,16 +60,25 @@ class FileLayerMapper extends AbstractLayerMapper
*/
private $repositoryManager;
/**
* Environment.
*
* @var Adapter<Environment>
*/
private $environmentAdapter;
/**
* Construct.
*
* @param RepositoryManager $repositoryManager Repository manager.
* @param RepositoryManager $repositoryManager Repository manager.
* @param Adapter<Environment> $environmentAdapter Environment adapter.
*/
public function __construct(RepositoryManager $repositoryManager)
public function __construct(RepositoryManager $repositoryManager, Adapter $environmentAdapter)
{
$this->repositoryManager = $repositoryManager;
parent::__construct();
$this->repositoryManager = $repositoryManager;
$this->environmentAdapter = $environmentAdapter;
}
/**
@@ -103,25 +114,26 @@ class FileLayerMapper extends AbstractLayerMapper
$layerId = $this->getElementId($model, $elementId);
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
$url = $this->environmentAdapter->get('url') . '/' . $fileModel->path;
switch ($model->fileFormat) {
case 'gpx':
$layer = new Gpx($layerId, $fileModel->path);
$layer = new Gpx($layerId, $url);
break;
case 'kml':
$layer = new Kml($layerId, $fileModel->path);
$layer = new Kml($layerId, $url);
break;
case 'wkt':
$layer = new Wkt($layerId, $fileModel->path);
$layer = new Wkt($layerId, $url);
break;
case 'geojson':
$layer = new OmnivoreGeoJson($layerId, $fileModel->path);
$layer = new OmnivoreGeoJson($layerId, $url);
break;
case 'topojson':
$layer = new TopoJson($layerId, $fileModel->path);
$layer = new TopoJson($layerId, $url);
break;
default: