Skip to content

Commit e56611f

Browse files
author
Michael Yu
committed
MAGETWO-92335: Architecture Review
- Revert name to locaation_name
1 parent da34917 commit e56611f

File tree

9 files changed

+28
-85
lines changed

9 files changed

+28
-85
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,69 +36,69 @@
3636
<entity name="PageBuilderMapLocationName_Default" type="pagebuilder_map_location_name_property">
3737
<data key="name">Location Name</data>
3838
<data key="section">general</data>
39-
<data key="fieldName">name</data>
39+
<data key="fieldName">location_name</data>
4040
<data key="value"/>
4141
</entity>
4242
<entity name="PageBuilderMapLocationName_TestLocation" type="pagebuilder_map_location_name_property">
4343
<data key="name">Location Name</data>
4444
<data key="section">general</data>
45-
<data key="fieldName">name</data>
45+
<data key="fieldName">location_name</data>
4646
<data key="value">Test Location 1</data>
4747
</entity>
4848
<entity name="PageBuilderMapLocationName_TestLocationEdit" type="pagebuilder_map_location_name_property">
4949
<data key="name">Location Name</data>
5050
<data key="section">general</data>
51-
<data key="fieldName">name</data>
51+
<data key="fieldName">location_name</data>
5252
<data key="value">Test Location 1 Edit</data>
5353
</entity>
5454
<entity name="PageBuilderMapLocationName_Empty" type="pagebuilder_map_location_name_property">
5555
<data key="name">Location Name</data>
5656
<data key="section">general</data>
57-
<data key="fieldName">name</data>
57+
<data key="fieldName">location_name</data>
5858
<data key="value"/>
5959
<data key="errorMessage">Please enter the location name.</data>
6060
</entity>
6161
<entity name="PageBuilderMapLocationName_Space" type="pagebuilder_map_location_name_property">
6262
<data key="name">Location Name</data>
6363
<data key="section">general</data>
64-
<data key="fieldName">name</data>
64+
<data key="fieldName">location_name</data>
6565
<data key="value"> </data>
6666
<data key="errorMessage">Please enter the location name.</data>
6767
</entity>
6868
<entity name="PageBuilderMapLocationName_CommonCharacters" type="pagebuilder_map_location_name_property">
6969
<data key="name">Location Name</data>
7070
<data key="section">general</data>
71-
<data key="fieldName">name</data>
71+
<data key="fieldName">location_name</data>
7272
<data key="value">1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ</data>
7373
</entity>
7474
<entity name="PageBuilderMapLocationName_SpecialCharacters" type="pagebuilder_map_location_name_property">
7575
<data key="name">Location Name</data>
7676
<data key="section">general</data>
77-
<data key="fieldName">name</data>
77+
<data key="fieldName">location_name</data>
7878
<data key="value">./;[]\-=&lt;&gt;?:"{}|_+!@#$%^&amp;*()`~Ω≈ç√∫˜µ≤≥÷åß∂ƒ©˙∆˚¬…æœ∑´®†¥¨ˆøπ“‘¡™£¢∞§¶•ªº–≠¸˛Ç◊ı˜Â¯˘¿ÅÍÎÏ˝ÓÔÒÚÆ☃Œ„´‰ˇÁ¨ˆØ∏”’`⁄€‹›fifl‡°·‚—±⅛⅜⅝⅞ЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя٠١٢٣٤٥٦٧٨٩ヽ</data>
7979
</entity>
8080
<entity name="PageBuilderMapLocationName_a" type="pagebuilder_map_location_name_property">
8181
<data key="name">Location Name</data>
8282
<data key="section">general</data>
83-
<data key="fieldName">name</data>
83+
<data key="fieldName">location_name</data>
8484
<data key="value">a</data>
8585
</entity>
8686
<entity name="PageBuilderMapLocationName_B" type="pagebuilder_map_location_name_property">
8787
<data key="name">Location Name</data>
8888
<data key="section">general</data>
89-
<data key="fieldName">name</data>
89+
<data key="fieldName">location_name</data>
9090
<data key="value">B</data>
9191
</entity>
9292
<entity name="PageBuilderMapLocationName_z" type="pagebuilder_map_location_name_property">
9393
<data key="name">Location Name</data>
9494
<data key="section">general</data>
95-
<data key="fieldName">name</data>
95+
<data key="fieldName">location_name</data>
9696
<data key="value">z</data>
9797
</entity>
9898
<entity name="PageBuilderMapLocationName_0" type="pagebuilder_map_location_name_property">
9999
<data key="name">Location Name</data>
100100
<data key="section">general</data>
101-
<data key="fieldName">name</data>
101+
<data key="fieldName">location_name</data>
102102
<data key="value">0</data>
103103
</entity>
104104
<!-- Latitude -->

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ Inline styles
899899
"latitude": 30.243475338635417,
900900
"longitude": -97.73760683593753
901901
},
902-
"name": "Location Name 1",
902+
"location_name": "Location Name 1",
903903
"phone": "512-111-1111",
904904
"address": "11501 Domain Dr #150",
905905
"city": "Austin",
@@ -914,7 +914,7 @@ Inline styles
914914
"latitude": 29.404737046411704,
915915
"longitude": -98.48467714843753
916916
},
917-
"name": "Location Name 2",
917+
"location_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: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@
150150
<class name="admin__field-wide">true</class>
151151
</additionalClasses>
152152
<componentType>dynamicRows</componentType>
153+
<dataScope>location</dataScope>
153154
</settings>
154155
<container name="record" component="Magento_Ui/js/dynamic-rows/record">
155156
<argument name="data" xsi:type="array">
@@ -160,11 +161,6 @@
160161
</item>
161162
</argument>
162163
<field name="location_name" component="Magento_Ui/js/form/element/text" formElement="input" >
163-
<argument name="data" xsi:type="array">
164-
<item name="config" xsi:type="array">
165-
<item name="sortBy" xsi:type="string">name</item>
166-
</item>
167-
</argument>
168164
<settings>
169165
<dataType>text</dataType>
170166
<label translate="true">Location Name</label>
@@ -173,12 +169,7 @@
173169
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
174170
</settings>
175171
</field>
176-
<field name="location_phone" component="Magento_Ui/js/form/element/text" formElement="input">
177-
<argument name="data" xsi:type="array">
178-
<item name="config" xsi:type="array">
179-
<item name="sortBy" xsi:type="string">phone</item>
180-
</item>
181-
</argument>
172+
<field name="phone" component="Magento_Ui/js/form/element/text" formElement="input">
182173
<settings>
183174
<dataType>text</dataType>
184175
<label translate="true">Phone Number</label>
@@ -187,12 +178,7 @@
187178
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
188179
</settings>
189180
</field>
190-
<field name="location_address" component="Magento_Ui/js/form/element/text" formElement="input">
191-
<argument name="data" xsi:type="array">
192-
<item name="config" xsi:type="array">
193-
<item name="sortBy" xsi:type="string">address</item>
194-
</item>
195-
</argument>
181+
<field name="address" component="Magento_Ui/js/form/element/text" formElement="input">
196182
<settings>
197183
<dataType>text</dataType>
198184
<label translate="true">Street Address</label>
@@ -201,12 +187,7 @@
201187
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
202188
</settings>
203189
</field>
204-
<field name="location_city" component="Magento_Ui/js/form/element/text" formElement="input">
205-
<argument name="data" xsi:type="array">
206-
<item name="config" xsi:type="array">
207-
<item name="sortBy" xsi:type="string">city</item>
208-
</item>
209-
</argument>
190+
<field name="city" component="Magento_Ui/js/form/element/text" formElement="input">
210191
<settings>
211192
<dataType>text</dataType>
212193
<label translate="true">City</label>
@@ -215,12 +196,7 @@
215196
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
216197
</settings>
217198
</field>
218-
<field name="location_state" component="Magento_Ui/js/form/element/text" formElement="input">
219-
<argument name="data" xsi:type="array">
220-
<item name="config" xsi:type="array">
221-
<item name="sortBy" xsi:type="string">state</item>
222-
</item>
223-
</argument>
199+
<field name="state" component="Magento_Ui/js/form/element/text" formElement="input">
224200
<settings>
225201
<dataType>text</dataType>
226202
<label translate="true">Region/State</label>
@@ -229,12 +205,7 @@
229205
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
230206
</settings>
231207
</field>
232-
<field name="location_zipcode" component="Magento_Ui/js/form/element/text" formElement="input">
233-
<argument name="data" xsi:type="array">
234-
<item name="config" xsi:type="array">
235-
<item name="sortBy" xsi:type="string">zipcode</item>
236-
</item>
237-
</argument>
208+
<field name="zipcode" component="Magento_Ui/js/form/element/text" formElement="input">
238209
<settings>
239210
<dataType>text</dataType>
240211
<label translate="true">Zip/Postal Code</label>
@@ -243,12 +214,7 @@
243214
<elementTmpl>ui/dynamic-rows/cells/text</elementTmpl>
244215
</settings>
245216
</field>
246-
<field name="location_country" component="Magento_Ui/js/form/element/text" formElement="input">
247-
<argument name="data" xsi:type="array">
248-
<item name="config" xsi:type="array">
249-
<item name="sortBy" xsi:type="string">country</item>
250-
</item>
251-
</argument>
217+
<field name="country" component="Magento_Ui/js/form/element/text" formElement="input">
252218
<settings>
253219
<dataType>text</dataType>
254220
<label translate="true">Country</label>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
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="name" sortOrder="20" formElement="input">
51+
<field name="location_name" sortOrder="20" formElement="input">
5252
<settings>
5353
<dataType>text</dataType>
5454
<label translate="true">Location Name</label>

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

Lines changed: 1 addition & 0 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/components/dynamic-rows.js

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,31 +48,6 @@ define([
4848
return this;
4949
},
5050

51-
/**
52-
* Init header elements
53-
*/
54-
initHeader: function () {
55-
var labels = [],
56-
data;
57-
58-
if (!this.labels().length) {
59-
_.each(this.childTemplate.children, function (cell) {
60-
data = this.createHeaderTemplate(cell.config);
61-
cell.config.labelVisible = false;
62-
_.extend(data, {
63-
label: cell.config.label,
64-
name: cell.name,
65-
required: !!cell.config.validation,
66-
columnsHeaderClasses: cell.config.columnsHeaderClasses,
67-
sortOrder: cell.config.sortOrder,
68-
sortBy: cell.config.sortBy
69-
});
70-
labels.push(data);
71-
}, this);
72-
this.labels(_.sortBy(labels, 'sortOrder'));
73-
}
74-
},
75-
7651
/**
7752
* Open the location modal and insert form with the data from selected record
7853
*
@@ -140,7 +115,7 @@ define([
140115
allLabels = this.labels().slice();
141116
allLabels.forEach(function (label) {
142117

143-
if (label.sortBy === property().sortBy) {
118+
if (label.name === property().name) {
144119
label.columnsHeaderClasses = '_ascend';
145120
} else {
146121
label.columnsHeaderClasses = '';
@@ -154,7 +129,7 @@ define([
154129
placeholder = this.emptyContentPlaceholder;
155130

156131
this.emptyContentPlaceholder = false;
157-
this.sortRecord(property().sortBy, ascend);
132+
this.sortRecord(property().name, ascend);
158133
this.reload();
159134
this.emptyContentPlaceholder = placeholder;
160135
}

app/code/Magento/PageBuilder/view/adminhtml/web/template/content-type/map/default/master.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
-->
77

8-
<div attr="data.main.attributes" ko-style="Object.assign({}, { display: data.main.attributes()['data-locations'] !== '[]' ? 'inline-block' : 'none' }, data.main.style())" css="data.main.css"></div>
8+
<div attr="data.main.attributes" data-bind="afterRender: function(){console.log(data.main.attributes())}" ko-style="Object.assign({}, { display: data.main.attributes()['data-locations'] !== '[]' ? 'inline-block' : 'none' }, data.main.style())" css="data.main.css"></div>

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type-factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export default function createContentType(
4848
const [previewComponent, contentComponent] = resolvedPromises;
4949
contentType.preview = previewComponent;
5050
contentType.content = contentComponent;
51+
debugger;
5152
contentType.dataStore.update(
5253
prepareData(config, data),
5354
);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import ko from "knockout";
77
import mageUtils from "mageUtils";
88
import events from "uiEvents";
9-
import Content from "./content";
9+
import Content from "./content-type/content";
1010
import ContentTypeConfigInterface from "./content-type-config.d";
1111
import ContentTypeInterface from "./content-type.d";
1212
import DataStore from "./data-store";
13-
import Preview from "./preview";
13+
import Preview from "./content-type/preview";
1414

1515
export default class ContentType implements ContentTypeInterface {
1616
public id: string = mageUtils.uniqueid();

0 commit comments

Comments
 (0)