-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
228 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Carbon\GeoMap\Migrations; | ||
|
||
use Neos\ContentRepository\Domain\Model\NodeData; | ||
use Neos\ContentRepository\Migration\Transformations\AbstractTransformation; | ||
use Neos\Neos\Controller\CreateContentContextTrait; | ||
|
||
class LocationMigration extends AbstractTransformation | ||
{ | ||
use CreateContentContextTrait; | ||
|
||
/** | ||
* @param NodeData $node | ||
* @return boolean | ||
*/ | ||
public function isTransformable(NodeData $node) | ||
{ | ||
if (!$node->hasProperty('lat') && !$node->hasProperty('lng')) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
/** | ||
* @param NodeData $node | ||
* @return void | ||
*/ | ||
public function execute(NodeData $node) | ||
{ | ||
$lat = (float)$node->getProperty('lat'); | ||
$lng = (float)$node->getProperty('lng'); | ||
$node->setProperty('location', [ | ||
'lat' => $lat, | ||
'lng' => $lng, | ||
]); | ||
$node->removeProperty('lat'); | ||
$node->removeProperty('lng'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
up: | ||
comments: 'Save lat and lng properties to location property' | ||
migration: | ||
- filters: | ||
- type: 'NodeType' | ||
settings: | ||
nodeType: 'Carbon.GeoMap:Mixin.Address' | ||
withSubTypes: true | ||
transformations: | ||
- type: 'Carbon\GeoMap\Migrations\LocationMigration' | ||
settings: [] | ||
|
||
|
||
down: | ||
comments: 'No down migration available' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,43 +3,22 @@ prototype(Carbon.GeoMap:Mixin.AddressElement) < prototype(Neos.Neos:ContentCompo | |
street = ${q(node).property('street')} | ||
city = ${q(node).property('city')} | ||
country = ${q(node).property('country')} | ||
lat = ${q(node).property('lat')} | ||
lng = ${q(node).property('lng')} | ||
location = ${q(node).property('location')} | ||
content = ${q(node).property('text')} | ||
renderPopup = ${q(node).property('renderPopup')} | ||
renderAddress = ${q(node).property('renderAddress')} | ||
renderCountry = ${q(node).property('renderCountry')} | ||
editable = ${node.context.inBackend} | ||
|
||
|
||
addressType = 'Carbon.GeoMap:Presentation.Address' | ||
mapType = ${null} | ||
type = 'Carbon.GeoMap:Presentation.Address' | ||
|
||
@if.hasAddressTypeAndMapType = ${this.addressType && this.mapType} | ||
@if.hasType = ${this.type} | ||
|
||
renderer = Neos.Fusion:Renderer { | ||
type = ${props.addressType} | ||
element = Neos.Fusion:DataStructure { | ||
@apply.props = ${props} | ||
} | ||
@process.wrap = Neos.Fusion:Renderer { | ||
@if.inCBDModeAndHasCoordinates = ${props.cbd && props.lat && props.lng} | ||
type = ${props.mapType} | ||
element.mode = 'edit' | ||
element.editable = true | ||
element.coordinates = ${[{'lat': props.lat, 'lng': props.lng}]} | ||
element.showPopup = ${value} | ||
element.mapStyle = ${q(node).parent().property('mapStyle')} | ||
element.inlineEditor = Carbon.GeoMap:Presentation.CoordinatesTable { | ||
lat = Neos.Neos:Editable { | ||
property = 'lat' | ||
block = false | ||
} | ||
lng = Neos.Neos:Editable { | ||
property = 'lng' | ||
block = false | ||
} | ||
} | ||
} | ||
} | ||
renderer = afx` | ||
<Neos.Fusion:Renderer | ||
type={props.type} | ||
[email protected]={props} | ||
/> | ||
` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'Carbon.GeoMap:Mixin.Location': | ||
abstract: true | ||
properties: | ||
location: | ||
type: array | ||
ui: | ||
label: i18n | ||
reloadPageIfChanged: true | ||
inspector: | ||
group: address | ||
position: end | ||
editor: 'Carbon.GeoMapEditor/Editor' | ||
hidden: 'ClientEval: node.properties.location && node.properties.location.lat && node.properties.location.lng ? false : true' | ||
editorOptions: | ||
searchBar: false |
Oops, something went wrong.