diff --git a/composer.json b/composer.json
index 4256dd6..5ebaa59 100644
--- a/composer.json
+++ b/composer.json
@@ -3,7 +3,7 @@
"description": "Advanced Banners (Digital Publishing) plugin",
"type": "shopware-platform-plugin",
"license": "MIT",
- "version": "2.1.0",
+ "version": "2.2.0",
"autoload": {
"psr-4": {
"RuneLaenen\\AdvancedBanners\\": "src/"
diff --git a/src/Resources/app/administration/src/module/rl-advanced-banners/component/layer/text/rl-advanced-banners-layer-config-text/index.js b/src/Resources/app/administration/src/module/rl-advanced-banners/component/layer/text/rl-advanced-banners-layer-config-text/index.js
index f7796c0..6096bc5 100644
--- a/src/Resources/app/administration/src/module/rl-advanced-banners/component/layer/text/rl-advanced-banners-layer-config-text/index.js
+++ b/src/Resources/app/administration/src/module/rl-advanced-banners/component/layer/text/rl-advanced-banners-layer-config-text/index.js
@@ -19,7 +19,6 @@ Component.register('rl-advanced-banners-layer-config-text', {
data() {
return {
- media: null,
isLoading: false
};
},
@@ -28,43 +27,5 @@ Component.register('rl-advanced-banners-layer-config-text', {
config() {
return this.layer.config || {};
},
- uploadTag() {
- return `rl-advanced-banners-layer-config-text-media-${this.layer.id}`;
- },
- mediaRepository() {
- return this.repositoryFactory.create('media');
- }
},
-
- created() {
- if (this.config.mediaId.length === 0) {
- return;
- }
-
- this.isLoading = true;
- this.mediaRepository.get(this.config.mediaId, Shopware.Context.api).then((mediaItem) => {
- this.media = mediaItem;
- this.isLoading = false;
- });
- },
-
- methods: {
- onSetMedia([mediaItem]) {
- this.$set(this.config, 'mediaId', mediaItem.id);
- this.media = mediaItem;
- },
-
- successfulUpload(media) {
- this.$set(this.config, 'mediaId', media.targetId);
-
- this.mediaRepository.get(media.targetId, Shopware.Context.api).then((mediaItem) => {
- this.media = mediaItem;
- });
- },
-
- removeMedia() {
- this.$set(this.config, 'mediaId', null);
- this.media = null;
- }
- }
});
diff --git a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/index.js b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/index.js
index 151be5a..67afe53 100644
--- a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/index.js
+++ b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/index.js
@@ -17,12 +17,6 @@ Component.register('rl-advanced-banners-detail-layer', {
}
},
- data() {
- return {
- showLayerConfig: false
- };
- },
-
created() {
if (Array.isArray(this.layer.config)) {
this.$set(this.layer, 'config', {});
@@ -41,11 +35,7 @@ Component.register('rl-advanced-banners-detail-layer', {
},
onLayerConfig() {
- this.showLayerConfig = true;
+ this.$emit('config-layer', this.layer);
},
-
- onConfigModalClose() {
- this.showLayerConfig = false;
- }
}
});
diff --git a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/rl-advanced-banners-detail-layer.html.twig b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/rl-advanced-banners-detail-layer.html.twig
index 36ba5fb..0297c36 100644
--- a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/rl-advanced-banners-detail-layer.html.twig
+++ b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-layer/rl-advanced-banners-detail-layer.html.twig
@@ -23,25 +23,5 @@
-
-
-
- {{ $tc('rl-advanced-banners.layer.modalTitle.' + layer.type) }}
-
-
-
- {{ $tc('rl-advanced-banners.layer.modalDoneButton') }}
-
-
-
-
-
{% endblock %}
diff --git a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/index.js b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/index.js
index dac53ac..8152975 100644
--- a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/index.js
+++ b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/index.js
@@ -44,17 +44,23 @@ Component.register('rl-advanced-banners-detail-sidebar', {
}
},
+ data() {
+ return {
+ layerConfigLayer: null
+ };
+ },
+
methods: {
addTextLayer() {
this.advancedBanner.data.layers.push({
id: utils.createId(),
type: 'text',
position: this.newMaxPosition,
- config: Object.assign(this.defaultConfig, {
+ config: {...this.defaultConfig, ...{
content: 'Placeholder text',
textAlignX: 'left',
textAlignY: 'top'
- })
+ }}
});
},
addImageLayer() {
@@ -62,11 +68,11 @@ Component.register('rl-advanced-banners-detail-sidebar', {
id: utils.createId(),
type: 'image',
position: this.newMaxPosition,
- config: Object.assign(this.defaultConfig, {
+ config: {...this.defaultConfig, ...{
mediaMode: 'cover',
mediaPositionX: 'center',
mediaPositionY: 'center',
- })
+ }}
});
},
addButtonLayer() {
@@ -74,14 +80,14 @@ Component.register('rl-advanced-banners-detail-sidebar', {
id: utils.createId(),
type: 'button',
position: this.newMaxPosition,
- config: Object.assign(this.defaultConfig, {
+ config: {...this.defaultConfig, ...{
buttonVariant: 'primary',
content: 'Click me!',
buttonLink: '',
buttonTarget: '_self',
buttonAlignX: 'left',
buttonAlignY: 'top'
- })
+ }}
});
},
addSolidLayer() {
@@ -89,11 +95,20 @@ Component.register('rl-advanced-banners-detail-sidebar', {
id: utils.createId(),
type: 'solid',
position: this.newMaxPosition,
- config: Object.assign(this.defaultConfig, {
+ config: {...this.defaultConfig, ...{
color: '#189eff'
- })
+ }}
});
},
+
+ onLayerConfig(layer) {
+ this.layerConfigLayer = layer;
+ },
+
+ onConfigModalClose() {
+ this.layerConfigLayer = null;
+ },
+
onLayerRemove(layer) {
const data = this.advancedBanner.data.layers;
diff --git a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/rl-advanced-banners-detail-sidebar.html.twig b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/rl-advanced-banners-detail-sidebar.html.twig
index 478674f..91cf2d2 100644
--- a/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/rl-advanced-banners-detail-sidebar.html.twig
+++ b/src/Resources/app/administration/src/module/rl-advanced-banners/component/rl-advanced-banners-detail-sidebar/rl-advanced-banners-detail-sidebar.html.twig
@@ -64,9 +64,31 @@
:layer="layer"
v-draggable="{ dragGroup: 'banner-layer', data: layer, onDragEnter: onLayerDragSort }"
v-droppable="{ dragGroup: 'banner-layer', data: layer }"
+ @config-layer="onLayerConfig(layer)"
@remove-layer="onLayerRemove(layer)">
{% endblock %}
+
+
+
+
+ {{ $tc('rl-advanced-banners.layer.modalTitle.' + layerConfigLayer.type) }}
+
+
+
+ {{ $tc('rl-advanced-banners.layer.modalDoneButton') }}
+
+
+
+
+
{% endblock %}