Skip to content

Commit

Permalink
#104363 - unify syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ofrankowska committed Apr 5, 2024
1 parent 5941456 commit 91dce59
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 42 deletions.
12 changes: 6 additions & 6 deletions view/adminhtml/web/vue/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,19 @@
required: true
}
},
data: function() {
data() {
return {
list: [],
selectedItem: null
};
},
computed: {
jsonList: function() {
jsonList() {
return JSON.stringify(this.list);
}
},
watch: {
jsonList: function (newValue) {
jsonList (newValue) {
this.updateSerializedNodes(newValue)
}
},
Expand All @@ -117,13 +117,13 @@
},
methods: {
uuid,
setSelectedNode: function(item) {
setSelectedNode(item) {
this.selectedItem = item;
},
removeNode: function(list, index) {
removeNode(list, index) {
list.splice(index, 1);
},
addNode: function(target) {
addNode(target) {
target.push({
id: this.uuid(),
uuid: this.uuid(),
Expand Down
2 changes: 1 addition & 1 deletion view/adminhtml/web/vue/field-type/autocomplete-lazy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
initialLoaded: false
}),
computed: {
placeholder: function() {
placeholder() {
return this.config.translation.pleaseSelect + ' ' + this.label.toLocaleLowerCase();
},
loadedOptions() {
Expand Down
4 changes: 2 additions & 2 deletions view/adminhtml/web/vue/field-type/autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@
}
}
},
placeholder: function() {
placeholder() {
return this.config.translation.pleaseSelect + ' ' + this.label.toLocaleLowerCase();
},
optionsTree: function() {
optionsTree() {
const hashTable = {},
optionsTree = [];
Expand Down
6 changes: 3 additions & 3 deletions view/adminhtml/web/vue/field-type/checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ define(["Vue"], function(Vue) {
required: true
}
},
data: function() {
data() {
return {
fieldId: '',
checkboxValue: this.value === '1' ? true : false
}
},
watch: {
checkboxValue: function(newValue) {
checkboxValue(newValue) {
this.item.is_active = newValue ? '1' : '0';
}
},
mounted: function() {
mounted() {
this.fieldId = 'snowmenu_' + this.id + '_' + this._uid;
},
template: template
Expand Down
26 changes: 13 additions & 13 deletions view/adminhtml/web/vue/field-type/image-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
required: true
}
},
data: function() {
data() {
return {
isDragging: false,
fieldId: '',
Expand All @@ -128,15 +128,15 @@
labelFileIsUploading: $t('Uploading file ...'),
}
},
mounted: function() {
mounted() {
this.fieldId = 'snowmenu_' + this.id + '_' + this._uid;
},
methods: {
setItemImage: function(file, url) {
setItemImage(file, url) {
this.item.image = file;
this.item.image_url = url;
},
uploadFileToServer: function() {
uploadFileToServer() {
this.fileIsUploading = true;
var formData = new FormData();
Expand Down Expand Up @@ -175,7 +175,7 @@
});
},
removeItemImage: function(e) {
removeItemImage(e) {
e.preventDefault();
if (!this.item.image) {
Expand Down Expand Up @@ -210,16 +210,16 @@
});
},
removeNewFile: function() {
removeNewFile() {
this.$refs.fileUpload.value = '';
this.previewImage = '';
},
assignImage: function(e) {
assignImage(e) {
this.previewImage = e.target.result;
},
previewUploadImage: function(file) {
previewUploadImage(file) {
this.file = file;
if (file.type && file.type.indexOf('image') === -1) {
Expand All @@ -234,28 +234,28 @@
reader.readAsDataURL(file);
},
chooseFile: function(e) {
chooseFile(e) {
e.preventDefault();
this.$refs.fileUpload.click()
},
onDragEnter: function(e) {
onDragEnter(e) {
e.preventDefault();
this.isDragging = true;
},
onDragLeave: function(e) {
onDragLeave(e) {
e.preventDefault();
this.isDragging = false;
},
onDrop: function(e) {
onDrop(e) {
e.preventDefault();
e.stopPropagation();
this.previewUploadImage(e.dataTransfer.files[0])
},
updateFile: function(event){
updateFile(event){
this.uploadError = '';
this.previewUploadImage(event.target.files[0]);
event.preventDefault();
Expand Down
6 changes: 3 additions & 3 deletions view/adminhtml/web/vue/field-type/simple-field.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@
default: null
}
},
data: function() {
data() {
return {
fieldId: ''
}
},
mounted: function() {
mounted() {
this.fieldId = 'snowmenu_' + this.id + '_' + this._uid;
},
methods: {
updateValue: function(value) {
updateValue(value) {
this.$emit('input', value);
}
},
Expand Down
14 changes: 7 additions & 7 deletions view/adminhtml/web/vue/menu-type.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
required: true
}
},
data: function() {
data() {
return {
draft: {},
isNodeActiveLabel: $t('Enabled'),
Expand All @@ -133,7 +133,7 @@
}
},
computed: {
isTemplateSectionVisible: function() {
isTemplateSectionVisible() {
var nodeId = this.templateList['node'],
submenuId = this.templateList['submenu'],
typeData = this.config.fieldData[this.item['type']];
Expand All @@ -144,7 +144,7 @@
return false;
},
options: function() {
options() {
var list = [];
for (type in this.config.nodeTypes) {
list.push({
Expand All @@ -154,15 +154,15 @@
}
return list;
},
templateOptions: function() {
templateOptions() {
return this.templateOptionsData[this.item['type']] || [];
},
showImage: function() {
showImage() {
return ['category', 'product', 'custom_url'].includes(this.item.type);
}
},
methods: {
changeType: function(selected) {
changeType(selected) {
if (selected && typeof selected === 'object') {
var type = this.item.type,
value = selected.value;
Expand All @@ -179,7 +179,7 @@
this.item['type'] = value;
}
},
getOptionLabel: function(option) {
getOptionLabel(option) {
if (typeof option === 'object') {
return option.label;
}
Expand Down
14 changes: 7 additions & 7 deletions view/adminhtml/web/vue/nested-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,44 +182,44 @@
required: true
},
},
data: function() {
data() {
return {
editItem: false,
collapsed: true
}
},
methods: {
selectedEvent: function(item) {
selectedEvent(item) {
if (typeof(this.selected) === 'function') {
this.selected(item);
}
},
appendEvent: function(list, index) {
appendEvent(list, index) {
this.editItem = false;
this.collapsed = false;
if (typeof(this.append) === 'function') {
this.append(list[index].columns);
}
},
duplicateEvent: function(list, index) {
duplicateEvent(list, index) {
if (typeof(this.duplicate) === 'function') {
this.duplicate(list, index);
}
},
deleteEvent: function(list, index) {
deleteEvent(list, index) {
this.editItem = false;
if (typeof(this.delete) === 'function') {
this.delete(list, index);
}
},
getNodeType: function(type) {
getNodeType(type) {
var nodeType = '';
if (type) {
nodeType = '(' + this.$root.config.nodeTypes[type] + ')';
}
return nodeType;
},
editNode: function() {
editNode() {
this.editItem = !this.editItem;
this.collapsed = !this.editItem;
}
Expand Down

0 comments on commit 91dce59

Please sign in to comment.