Skip to content

Commit

Permalink
Merge pull request #519 from BitBagCommerce/feature/OP-470
Browse files Browse the repository at this point in the history
OP-470: Block preview functionality
  • Loading branch information
jkindly authored Aug 14, 2024
2 parents ae9fff2 + 0a4c10c commit 8a8e3e6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/Controller/BlockController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function previewAction(Request $request): Response
return $this->render($configuration->getTemplate(ResourceActions::CREATE . '.html'), [
'resource' => $block,
$this->metadata->getName() => $block,
'blockTemplate' => self::BLOCK_TEMPLATE,
]);
}
}
11 changes: 11 additions & 0 deletions src/Resources/views/Block/Crud/_form.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% from '@BitBagSyliusCmsPlugin/Macro/translationForm.html.twig' import translationForm %}
{% form_theme form '@BitBagSyliusCmsPlugin/Form/theme.html.twig' %}

{% include '@BitBagSyliusCmsPlugin/Modal/_resourcePreview.html.twig' %}
{% include '@BitBagSyliusCmsPlugin/Modal/_loadTemplateConfirmation.html.twig' %}

<div class="ui two column stackable grid">
Expand All @@ -12,6 +14,15 @@
{{ form_row(form.channels) }}
{{ form_row(form.locales) }}
{{ form_row(form.collections) }}
<a
href="#"
class="ui labeled button icon primary bitbag-cms-resource-preview"
data-url="{{ path('bitbag_sylius_cms_plugin_admin_block_preview') }}"
data-bb-cms-preview-btn
>
<i class="eye icon"></i>
{{ 'bitbag_sylius_cms_plugin.ui.preview'|trans }}
</a>
</div>
<div class="ui segment">
<h4 class="ui dividing header">{{ 'bitbag_sylius_cms_plugin.ui.manage_block_display'|trans }}</h4>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/Block/preview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% block content %}
<div class="column">
<div class="ui segment">
{% include blockTemplate %}
{{ bitbag_cms_render_content_elements(block) }}
</div>
</div>
{% endblock %}

0 comments on commit 8a8e3e6

Please sign in to comment.