Skip to content

Commit ec32d7c

Browse files
author
Michael Yu
committed
MAGETWO-92335: Architecture Review
- Updated field name location_name to name - Fixed document white spacing - Updated lat and lng abbreviation to latitude and longitude
1 parent 655ae6d commit ec32d7c

File tree

15 files changed

+113
-113
lines changed

15 files changed

+113
-113
lines changed

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/Map.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ private function renderMapLocations($eavData)
9292
{
9393
if (isset($eavData['map'])) {
9494
$map = explode(',', $eavData['map']);
95-
$this->rootElementAttributes['data-locations'] = '[{"position":{"lat":'
95+
$this->rootElementAttributes['data-locations'] = '[{"position":{"latitude":'
9696
. $map[0]
97-
. ',"lng":'
97+
. ',"longitude":'
9898
. $map[1]
9999
. '}}]';
100100
}

app/code/Magento/PageBuilder/Test/Mftf/Data/MapData.xml

Lines changed: 51 additions & 51 deletions
Large diffs are not rendered by default.

app/code/Magento/PageBuilder/Test/Mftf/Section/PageBuilderMapSection.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<element name="pin" type="button" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[@class='gmnoprint']/img[contains(@src,'spotlight-poi2_hdpi.png')]|(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[@class='gmnoprint']/img[contains(@src,'spotlight-poi2.png')]" parameterized="true"/>
1515
<element name="pinLocations" type="button" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[contains(@style,'transform: matrix(1, 0, 0, 1, ')]" parameterized="true"/>
1616
<!-- Location Pin Configuration -->
17-
<element name="latitude" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[contains(@data-locations,'&quot;position&quot;:{&quot;lat&quot;:{{arg2}},')]" parameterized="true"/>
18-
<element name="longitude" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[contains(@data-locations,',&quot;lng&quot;:{{arg2}}}')]" parameterized="true"/>
17+
<element name="latitude" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[contains(@data-locations,'&quot;position&quot;:{&quot;latitude&quot;:{{arg2}},')]" parameterized="true"/>
18+
<element name="longitude" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[contains(@data-locations,',&quot;longitude&quot;:{{arg2}}}')]" parameterized="true"/>
1919
<element name="tooltipWindow" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[@class='gm-style-iw']" parameterized="true"/>
2020
<element name="tooltipWindowClose" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[@class='gm-style-iw']/../div/img[contains(@src,'mapcnt6.png')]/.." parameterized="true"/>
2121
<element name="locationName" type="text" selector="(//div[contains(@class,'pagebuilder-map')])[{{arg1}}]//div[@class='gm-style-iw']//div/h3/b[.='{{arg2}}']" parameterized="true"/>
@@ -61,8 +61,8 @@
6161
<element name="pinLocations" type="button" selector="(//div[@data-role='map'])[{{arg1}}]//div[contains(@style,'transform: matrix(1, 0, 0, 1, ')]" parameterized="true"/>
6262
<element name="zoom" type="button" selector="(//div[@data-role='map'])[{{arg1}}][@data-zoom='{{arg2}}']" parameterized="true"/>
6363
<!-- Location Pin Configuration -->
64-
<element name="latitude" type="text" selector="(//div[@data-role='map'])[{{arg1}}][contains(@data-locations,'&quot;position&quot;:{&quot;lat&quot;:{{arg2}},')]" parameterized="true"/>
65-
<element name="longitude" type="text" selector="(//div[@data-role='map'])[{{arg1}}][contains(@data-locations,',&quot;lng&quot;:{{arg2}}}')]" parameterized="true"/>
64+
<element name="latitude" type="text" selector="(//div[@data-role='map'])[{{arg1}}][contains(@data-locations,'&quot;position&quot;:{&quot;latitude&quot;:{{arg2}},')]" parameterized="true"/>
65+
<element name="longitude" type="text" selector="(//div[@data-role='map'])[{{arg1}}][contains(@data-locations,',&quot;longitude&quot;:{{arg2}}}')]" parameterized="true"/>
6666
<element name="tooltipWindow" type="text" selector="(//div[@data-role='map'])[{{arg1}}]//div[@class='gm-style-iw']" parameterized="true"/>
6767
<element name="tooltipWindowClose" type="text" selector="(//div[@data-role='map'])[{{arg1}}]//div[@class='gm-style-iw']/../div/img[contains(@src,'mapcnt6.png')]/.." parameterized="true"/>
6868
<element name="locationName" type="text" selector="(//div[@data-role='map'])[{{arg1}}]//div[@class='gm-style-iw']//div/h3/b[.='{{arg2}}']" parameterized="true"/>

app/code/Magento/PageBuilder/docs/master-format.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -896,10 +896,10 @@ Inline styles
896896
[
897897
{
898898
"position": {
899-
"lat":30.243475338635417,
900-
"lng":-97.73760683593753
899+
"latitude": 30.243475338635417,
900+
"longitude": -97.73760683593753
901901
},
902-
"location_name": "Location Name 1",
902+
"name": "Location Name 1",
903903
"phone": "512-111-1111",
904904
"address": "11501 Domain Dr #150",
905905
"city": "Austin",
@@ -911,10 +911,10 @@ Inline styles
911911
},
912912
{
913913
"position": {
914-
"lat":29.404737046411704,
915-
"lng":-98.48467714843753
914+
"latitude": 29.404737046411704,
915+
"longitude": -98.48467714843753
916916
},
917-
"location_name": "Location Name 2",
917+
"name": "Location Name 2",
918918
"phone": "512-222-2222",
919919
"address": "849 E Commerce St",
920920
"city": "San Antonio",

app/code/Magento/PageBuilder/view/adminhtml/ui_component/pagebuilder_map_form.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@
159159
<item name="componentType" xsi:type="string">container</item>
160160
</item>
161161
</argument>
162-
<field name="location_name" component="Magento_Ui/js/form/element/text" formElement="input" >
162+
<field name="name" component="Magento_Ui/js/form/element/text" formElement="input" >
163163
<settings>
164164
<dataType>text</dataType>
165165
<label translate="true">Location Name</label>
166166
<visible>true</visible>
167-
<dataScope>location_name</dataScope>
167+
<dataScope>name</dataScope>
168168
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
169169
</settings>
170170
</field>

app/code/Magento/PageBuilder/view/adminhtml/ui_component/pagebuilder_map_location_form.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@
4848
<notice translate="true">You can move the pin by clicking or dragging it where you want. To alter the zoom please use the controls.</notice>
4949
</settings>
5050
</field>
51-
<field name="location_name" sortOrder="20" formElement="input">
51+
<field name="name" sortOrder="20" formElement="input">
5252
<settings>
5353
<dataType>text</dataType>
5454
<label translate="true">Location Name</label>
55-
<dataScope>location_name</dataScope>
55+
<dataScope>name</dataScope>
5656
<validation>
5757
<rule name="required-entry-location-name" xsi:type="boolean">true</rule>
5858
<rule name="required-entry" xsi:type="boolean">true</rule>
@@ -69,9 +69,9 @@
6969
<item name="label" translate="true" xsi:type="string">Coordinates</item>
7070
</item>
7171
</argument>
72-
<field name="position[lat]" formElement="input">
72+
<field name="position[latitude]" formElement="input">
7373
<settings>
74-
<dataScope>position.lat</dataScope>
74+
<dataScope>position.latitude</dataScope>
7575
<dataType>text</dataType>
7676
<additionalClasses>
7777
<class name="admin__field-small">true</class>
@@ -84,9 +84,9 @@
8484
<placeholder translate="true">Latitude</placeholder>
8585
</settings>
8686
</field>
87-
<field name="position[lng]" formElement="input">
87+
<field name="position[longitude]" formElement="input">
8888
<settings>
89-
<dataScope>position.lng</dataScope>
89+
<dataScope>position.longitude</dataScope>
9090
<dataType>text</dataType>
9191
<additionalClasses>
9292
<class name="admin__field-small">true</class>

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/map/converter/attribute/locations.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/map/preview.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/map.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ define([
3737
mapOptions = {
3838
zoom: 8,
3939
center: new google.maps.LatLng(
40-
!isNaN(startValue.lat) && startValue.lat !== '' ? startValue.lat : 30.2672,
41-
!isNaN(startValue.lng) && startValue.lng !== '' ? startValue.lng : -97.7431
40+
!isNaN(startValue.latitude) && startValue.latitude !== '' ? startValue.latitude : 30.2672,
41+
!isNaN(startValue.longitude) && startValue.longitude !== '' ? startValue.longitude : -97.7431
4242
),
4343
scrollwheel: false,
4444
disableDoubleClickZoom: false,
@@ -57,10 +57,10 @@ define([
5757

5858
// Add marker if there is a start value
5959
if (this.value()) {
60-
this.addMarker(startValue.lat, startValue.lng);
60+
this.addMarker(startValue.latitude, startValue.longitude);
6161
}
6262

63-
// After click, add and update both Lat and Lng.
63+
// After click, add and update both Latitude and Longitude.
6464
google.maps.event.addListener(this.map, 'click', this.onClick.bind(this));
6565
google.maps.event.addListener(this.map, 'dblclick', this.onDblClick.bind(this));
6666
google.maps.event.trigger(this.marker, 'click');
@@ -117,7 +117,7 @@ define([
117117
var content = this.value(),
118118
latitudeLongitude;
119119

120-
if (this.marker && content.lat === '' && content.lng === '') {
120+
if (this.marker && content.latitude === '' && content.longitude === '') {
121121
this.marker.setMap(null);
122122
delete this.marker;
123123

@@ -135,7 +135,7 @@ define([
135135
content = JSON.parse(this.value());
136136
}
137137

138-
latitudeLongitude = new google.maps.LatLng(parseFloat(content.lat), parseFloat(content.lng));
138+
latitudeLongitude = new google.maps.LatLng(parseFloat(content.latitude), parseFloat(content.longitude));
139139

140140
if (!this.marker) {
141141
this.addMarker(latitudeLongitude.lat(), latitudeLongitude.lng());
@@ -154,14 +154,14 @@ define([
154154
validateCoordinate: function (coordinates) {
155155
var valid = true;
156156

157-
if (coordinates.lng === '' ||
158-
coordinates.lat === '' ||
159-
isNaN(coordinates.lng) ||
160-
isNaN(coordinates.lat) ||
161-
parseFloat(coordinates.lng) < -180 ||
162-
parseFloat(coordinates.lng) > 180 ||
163-
parseFloat(coordinates.lat) < -90 ||
164-
parseFloat(coordinates.lat) > 90
157+
if (coordinates.longitude === '' ||
158+
coordinates.latitude === '' ||
159+
isNaN(coordinates.longitude) ||
160+
isNaN(coordinates.latitude) ||
161+
parseFloat(coordinates.longitude) < -180 ||
162+
parseFloat(coordinates.longitude) > 180 ||
163+
parseFloat(coordinates.latitude) < -90 ||
164+
parseFloat(coordinates.latitude) > 90
165165
) {
166166
valid = false;
167167
}
@@ -170,7 +170,7 @@ define([
170170
},
171171

172172
/**
173-
* Returns current lat, lng, and zoom level as a single string
173+
* Returns current latitude and longitude as an object
174174
*
175175
* @param {Object} coordinate
176176
* @return {Object}
@@ -181,8 +181,8 @@ define([
181181
currentCoordinate = coordinate ? coordinate : position;
182182

183183
return {
184-
lat: currentCoordinate.lat(),
185-
lng: currentCoordinate.lng()
184+
latitude: currentCoordinate.lat(),
185+
longitude: currentCoordinate.lng()
186186
};
187187
}
188188
});

app/code/Magento/PageBuilder/view/adminhtml/web/template/form/element/map.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="admin__field admin__field-map">
99
<div class="map-field" data-bind="afterRender: renderMap"></div>
1010
<div attr="id: uid, name: inputName">
11-
<input type="text" ko-value="value().lng" attr="name: inputName + '.lng'"/>
12-
<input type="text" ko-value="value().lat" attr="name: inputName + '.lat'"/>
11+
<input type="text" ko-value="value().longitude" attr="name: inputName + '.longitude'"/>
12+
<input type="text" ko-value="value().latitude" attr="name: inputName + '.latitude'"/>
1313
</div>
1414
</div>

0 commit comments

Comments
 (0)