feat(main): Groups and blocks

This commit is contained in:
2026-08-10 16:13:15 +02:00
parent 6aff506cd6
commit 635c13a0ed
39 changed files with 1188 additions and 237 deletions
@@ -1,25 +1,25 @@
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}
{% form_theme customHtmlForm '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit.html.twig' %}
{% form_theme customHtmlBlockForm '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit.html.twig' %}
{% block customhtml_form_block %}
{% block customhtmlblock_form_block %}
<div class="card">
{{ form_start(customHtmlForm) }}
{{ form_start(customHtmlBlockForm) }}
<div class="card-header">
<h3 class="card-header-title">
{{ 'Custom HTML Block'|trans({}, 'Modules.Wscustomhtml.Admin') }}
</h3>
</div>
<div class="card-body">
{{ form_rest(customHtmlForm) }}
{{ form_rest(customHtmlBlockForm) }}
</div>
<div class="card-footer">
<a href="{{ path('customhtml_index') }}" class="btn btn-outline-secondary">
<a href="{{ path('customhtmlblock_index') }}" class="btn btn-outline-secondary">
{{ 'Cancel'|trans({}, 'Admin.Actions') }}
</a>
<button class="btn btn-primary float-right">
{{ 'Save'|trans({}, 'Admin.Actions') }}
</button>
</div>
{{ form_end(customHtmlForm) }}
{{ form_end(customHtmlBlockForm) }}
</div>
{% endblock %}
@@ -0,0 +1,30 @@
{% import '@PrestaShop/Admin/macros.html.twig' as ps %}
{% form_theme customHtmlGroupForm '@PrestaShop/Admin/TwigTemplateForm/prestashop_ui_kit.html.twig' %}
{% block customhtmlgroup_form_block %}
<div class="card">
{{ form_start(customHtmlGroupForm) }}
<div class="card-header">
<h3 class="card-header-title">
{{ 'Custom HTML Group'|trans({}, 'Modules.Wscustomhtml.Admin') }}
</h3>
</div>
<div class="card-body">
{{ form_rest(customHtmlGroupForm) }}
</div>
<div class="card-footer">
<a href="{{ path('customhtmlgroup_index') }}" class="btn btn-outline-secondary">
{{ 'Cancel'|trans({}, 'Admin.Actions') }}
</a>
{% if idCustomHtmlGroup is defined %}
<a href="{{ path('customhtmlblock_create', {'idGroup': idCustomHtmlGroup}) }}" class="btn btn-outline-primary">
{{ 'Add block'|trans({}, 'Modules.Wscustomhtml.Admin') }}
</a>
{% endif %}
<button class="btn btn-primary float-right">
{{ 'Save'|trans({}, 'Admin.Actions') }}
</button>
</div>
{{ form_end(customHtmlGroupForm) }}
</div>
{% endblock %}
@@ -1,8 +1,8 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtml_edit_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/form.html.twig' %}
{% block customhtmlblock_create_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/block_form.html.twig' %}
{% endblock %}
{% endblock %}
@@ -11,9 +11,7 @@
<script>
$(document).ready(function () {
window.prestashop.component.initComponents([
'TranslatableField',
'TinyMCEEditor',
'TranslatableInput',
]);
});
</script>
@@ -1,8 +1,8 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtml_create_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/form.html.twig' %}
{% block customhtmlblock_edit_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/block_form.html.twig' %}
{% endblock %}
{% endblock %}
@@ -11,9 +11,7 @@
<script>
$(document).ready(function () {
window.prestashop.component.initComponents([
'TranslatableField',
'TinyMCEEditor',
'TranslatableInput',
]);
});
</script>
@@ -0,0 +1,7 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtmlgroup_create_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/group_form.html.twig' %}
{% endblock %}
{% endblock %}
@@ -0,0 +1,7 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtmlgroup_edit_form %}
{% include '@Modules/ws_customhtml/views/templates/admin/form/blocks/group_form.html.twig' %}
{% endblock %}
{% endblock %}
@@ -1,20 +0,0 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtml_list %}
<div class="row">
<div class="col">
{% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' with {'grid': customHtmlGrid} %}
</div>
</div>
{% endblock %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function () {
new window.prestashop.component.Grid('customhtml');
});
</script>
{% endblock %}
@@ -0,0 +1,25 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtmlblock_list %}
<div class="row">
<div class="col">
{% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' with {'grid': customHtmlBlockGrid} %}
</div>
</div>
{% endblock %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function () {
const customhtmlblockGrid = new window.prestashop.component.Grid('customhtmlblock');
customhtmlblockGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
customhtmlblockGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
customhtmlblockGrid.addExtension(new window.prestashop.component.GridExtensions.ColumnTogglingExtension());
customhtmlblockGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
});
</script>
{% endblock %}
@@ -0,0 +1,25 @@
{% extends '@PrestaShop/Admin/layout.html.twig' %}
{% block content %}
{% block customhtmlgroup_list %}
<div class="row">
<div class="col">
{% include '@PrestaShop/Admin/Common/Grid/grid_panel.html.twig' with {'grid': customHtmlGroupGrid} %}
</div>
</div>
{% endblock %}
{% endblock %}
{% block javascripts %}
{{ parent() }}
<script>
$(document).ready(function () {
const customhtmlgroupGrid = new window.prestashop.component.Grid('customhtmlgroup');
customhtmlgroupGrid.addExtension(new window.prestashop.component.GridExtensions.SortingExtension());
customhtmlgroupGrid.addExtension(new window.prestashop.component.GridExtensions.FiltersResetExtension());
customhtmlgroupGrid.addExtension(new window.prestashop.component.GridExtensions.ColumnTogglingExtension());
customhtmlgroupGrid.addExtension(new window.prestashop.component.GridExtensions.SubmitRowActionExtension());
});
</script>
{% endblock %}