Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,33 @@
</sw-card>
{% endblock %}

{% block werkl_cms_element_blog_detail_config_back_button %}
<sw-card
:title="$tc('werkl-blog.elements.blogDetail.config.backButton.label')"
:hero="false"
:isLoading="false"
:large="false"
class="werkl-cms-el-config-blog-detail-back-button">

{% block werkl_cms_element_blog_detail_config_back_button_show %}
<mt-checkbox
v-model:checked="element.config.showBackButton.value"
:label="$tc('werkl-blog.elements.blogDetail.config.backButton.showBackButton')"
/>
{% endblock %}

{% block werkl_cms_element_blog_detail_config_back_button_url %}
<mt-text-field
v-model:value="element.config.backButtonUrl.value"
:label="$tc('werkl-blog.elements.blogDetail.config.backButton.backButtonUrl')"
:placeholder="$tc('werkl-blog.elements.blogDetail.config.backButton.backButtonUrlPlaceholder')"
:helpText="$tc('werkl-blog.elements.blogDetail.config.backButton.backButtonUrlHelp')"
:disabled="!element.config.showBackButton.value"
/>
{% endblock %}

</sw-card>
{% endblock %}

</div>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,13 @@ Shopware.Service('cmsService').registerCmsElement({
source: 'static',
value: false,
},
showBackButton: {
source: 'static',
value: false,
},
backButtonUrl: {
source: 'static',
value: '',
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@
"showAuthor": "Zeige Autor",
"showCategory": "Zeige Kategorie",
"fullWidth": "Volle Breite"
},
"backButton": {
"label": "Zurück zum Listing Button",
"showBackButton": "Zeige \"Zurück zum Listing\" Button",
"backButtonUrl": "Listing-Seiten URL",
"backButtonUrlPlaceholder": "z.B. /blog - leer lassen für browser history.back()",
"backButtonUrlHelp": "Nur verfügbar wenn der \"Zurück zum Listing\" Button aktiviert ist"
}
},
"component": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@
"showAuthor": "Show author",
"showCategory": "Show category",
"fullWidth": "Full width"
},
"backButton": {
"label": "Back to listing button",
"showBackButton": "Show \"Back to listing\" button",
"backButtonUrl": "Listing page URL",
"backButtonUrlPlaceholder": "e.g. /blog - leave empty for browser history.back()",
"backButtonUrlHelp": "Only available when the \"Back to listing\" button is enabled"
}
},
"component": {
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/snippet/de_DE/storefront.de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"meta": {
"author": "Autor",
"category": "Kategorien"
},
"backButton": {
"text": "Zurück zum Listing"
}
},
"element": {
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/snippet/en_GB/storefront.en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"meta": {
"author": "Author",
"category": "Categories"
},
"backButton": {
"text": "Back to listing"
}
},
"element": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
{% block werkl_blog_detail %}
{% if element.data %}
{% set showBackButton = element.fieldConfig.elements.showBackButton.value ?? element.config.showBackButton.value %}
{% set backButtonUrl = element.fieldConfig.elements.backButtonUrl.value ?? element.config.backButtonUrl.value %}

{% block werkl_blog_detail_back_button %}
{% if showBackButton %}
<div class="werkl-blog-detail-back-button mb-3">
{% if backButtonUrl %}
<a href="{{ backButtonUrl }}" class="btn btn-secondary">
{{ 'werkl-blog.detail.backButton.text'|trans }}
</a>
{% else %}
<button type="button" class="btn btn-secondary" onclick="history.back()">
{{ 'werkl-blog.detail.backButton.text'|trans }}
</button>
{% endif %}
</div>
{% endif %}
{% endblock %}

<article class="werkl-blog-detail row"
itemprop="article"
itemscope
Expand Down