From cdbd97e59587ad37be2418015ce8335b78653335 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 6 Aug 2021 21:32:10 +0200 Subject: [PATCH] passing option binModalStep from twig include template --- .../Resources/public/vuejs/Address/App.vue | 4 ++-- .../vuejs/Address/components/AddAddress.vue | 4 ++-- .../Address/_insert_vue_address.html.twig | 6 ++++++ .../Resources/views/Address/edit.html.twig | 4 +++- .../Resources/views/Address/new.html.twig | 21 +++++++------------ 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index 1ef9b0186..c6a2ed8c8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -65,8 +65,8 @@ export default { }, /// Display each step in page or Modal bindModal: { - //step1: false, - //step2: false + step1: window.binModalStep1, + step2: window.binModalStep2 }, // Options only for root parent component displayResult: true, diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue index fce900142..be5e7038a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/components/AddAddress.vue @@ -190,11 +190,11 @@ export default { }, computed: { step1WithModal() { - return (this.options.bindModal && typeof this.options.bindModal.step1 !== 'undefined') ? + return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ? this.options.bindModal.step1 : this.default.bindModal.step1; }, step2WithModal() { - let step2 = (this.options.bindModal && typeof this.options.bindModal.step2 !== 'undefined') ? + let step2 = (this.options.bindModal !== null && typeof this.options.bindModal.step2 !== 'undefined') ? this.options.bindModal.step2 : this.default.bindModal.step2; if (step2 === false && this.step1WithModal === true) { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig index fc231c02f..bb70a976a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/_insert_vue_address.html.twig @@ -22,6 +22,12 @@ {% if buttonDisplay is defined and buttonDisplay == false %} window.button.display = false; {% endif %} +{% if binModalStep1 is defined and binModalStep1 == false %} + window.binModalStep1 = false +{% endif %} +{% if binModalStep2 is defined and binModalStep2 == false %} + window.binModalStep2 = false +{% endif %} {{ encore_entry_script_tags('vue_address') }} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig index 366ec5b64..1fb7607d5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/edit.html.twig @@ -28,7 +28,9 @@ {% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { address_id: person.lastAddress.id, - mode: 'edit' + mode: 'edit', + binModalStep1: false, + binModalStep2: false, } %} {% endblock %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig index cd45d66ea..2bb1654f6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Address/new.html.twig @@ -25,21 +25,16 @@ {% block content %}

{{ block('title') }}

-
+ + {% include '@ChillPerson/Address/_insert_vue_address.html.twig' with { + address_id: person.lastAddress.id, + mode: 'new', + binModalStep1: false, + binModalStep2: false, + } %} + {% endblock %} {% endblock %} -{% block css %} - {{ encore_entry_link_tags('vue_address') }} -{% endblock %} - -{% block js %} - - {{ encore_entry_script_tags('vue_address') }} -{% endblock %}