Skip to content

Commit

Permalink
OP-515: Remove use template button
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Sep 10, 2024
1 parent c388771 commit 7a4c5ff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
19 changes: 13 additions & 6 deletions src/Resources/assets/admin/js/cms/cms-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ export class HandleTemplate {
const cmsPageTemplate = $('#sylius_cms_page_template');
const cmsBlockTemplate = $('#sylius_cms_block_template');

cmsLoadTemplate.on('click', function (e) {
e.preventDefault();

if (!cmsPageTemplate.val() && !cmsBlockTemplate.val()) {
return;
cmsPageTemplate.on('change', function() {
if ($(this).val()) {
$('#load-template-confirmation-modal').modal('show');
}
});

$('#load-template-confirmation-modal').modal('show');
cmsBlockTemplate.on('change', function() {
if ($(this).val()) {
$('#load-template-confirmation-modal').modal('show');
}
});

$('#load-template-confirmation-button').on('click', function () {
Expand Down Expand Up @@ -55,6 +57,11 @@ export class HandleTemplate {
}
});
});

$('#load-template-cancel-button').on('click', function () {
cmsPageTemplate.val('');
cmsBlockTemplate.val('');
});
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<p>{{ 'sylius_cms.ui.load_template_confirmation_modal_text'|trans }}</p>
</div>
<div class="actions">
<div class="ui red basic cancel inverted button">
<div class="ui red basic cancel inverted button" id="load-template-cancel-button">
<i class="remove icon"></i>
{{ 'sylius.ui.no_label'|trans }}
</div>
Expand Down
8 changes: 2 additions & 6 deletions src/Resources/views/Template/form.html.twig
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<div class="ui segment">
<h5 class="ui header">{{ 'sylius_cms.ui.use_page_template'|trans }}</h5>
<div class="ui two column stackable grid">
<div class="ui one column stackable grid">
<div class="column">
{{ form_row(form.template) }}
</div>
<div class="column">
<a href="#" class="ui labeled icon button" data-bb-cms-load-template="{{ ajax_url }}">
<i class="sign-in alternate icon"></i> {{ 'sylius_cms.ui.use_this_template'|trans }}
</a>
<input type="hidden" data-bb-cms-load-template="{{ ajax_url }}">
</div>
</div>
</div>

0 comments on commit 7a4c5ff

Please sign in to comment.