Address: remove forceRedirect option: backUrl option not null is considerated as forceRedirect true

This commit is contained in:
Mathieu Jaumotte 2021-09-22 13:18:46 +02:00
parent dbb9e6a663
commit dfc6ed9bf3
10 changed files with 14 additions and 28 deletions

View File

@ -252,7 +252,6 @@ export default {
validFrom: false, validFrom: false,
validTo: false validTo: false
}, },
forceRedirect: false,
hideAddress: false hideAddress: false
}, },
entity: { entity: {
@ -324,6 +323,9 @@ export default {
bypassFirstStep() { bypassFirstStep() {
// exception: passing step0 if new address and pane are not in modal // exception: passing step0 if new address and pane are not in modal
return !this.context.edit && !this.inModal; return !this.context.edit && !this.inModal;
},
forceRedirect() {
return this.context.backUrl !== null;
} }
}, },
mounted() { mounted() {
@ -396,7 +398,7 @@ export default {
this.openDatePane(); this.openDatePane();
} else { } else {
this.applyChanges(); this.applyChanges();
if (!this.options.forceRedirect) { if (!this.forceRedirect) {
this.openShowPane(); this.openShowPane();
} }
} }
@ -425,7 +427,7 @@ export default {
*/ */
afterLastPaneAction(params) { afterLastPaneAction(params) {
this.initForm(); this.initForm();
if (this.options.forceRedirect === true) { if (this.forceRedirect) {
console.log("redirect to backUrl"); console.log("redirect to backUrl");
window.location.assign(this.context.backUrl); window.location.assign(this.context.backUrl);
} else { } else {

View File

@ -86,8 +86,7 @@ export default {
this.options.hideAddress : this.defaultz.hideAddress; this.options.hideAddress : this.defaultz.hideAddress;
}, },
forceRedirect() { forceRedirect() {
return (typeof this.options.forceRedirect !== 'undefined') ? return this.context.backUrl !== null;
this.options.forceRedirect : this.defaultz.forceRedirect;
}, },
noAddressWithStickyActions() { noAddressWithStickyActions() {
return !this.context.edit && !this.address.id && this.options.stickyActions; return !this.context.edit && !this.address.id && this.options.stickyActions;

View File

@ -52,9 +52,6 @@ containers.forEach((container) => {
validTo: container.dataset.useValidTo === 'true' //boolean, default: false validTo: container.dataset.useValidTo === 'true' //boolean, default: false
}, },
/// Force redirection after last step (cfr. backUrl)
forceRedirect: container.dataset.forceRedirect === 'true', //boolean, default: false
/// Don't display show renderbox Address: showPane display only a button /// Don't display show renderbox Address: showPane display only a button
hideAddress: container.dataset.hideAddress === 'true' //boolean, default: false hideAddress: container.dataset.hideAddress === 'true' //boolean, default: false
} }

View File

@ -18,7 +18,6 @@
* stickyActions bool (default: false) * stickyActions bool (default: false)
* useValidFrom bool (default: false) * useValidFrom bool (default: false)
* useValidTo bool (default: false) * useValidTo bool (default: false)
* forceRedirect bool (default: false)
* hideAddress bool (default: false) * hideAddress bool (default: false)
#} #}
<div class="address-container" <div class="address-container"
@ -70,10 +69,6 @@
data-use-valid-to="true" data-use-valid-to="true"
{% endif %} {% endif %}
{% if forceRedirect is defined and forceRedirect == 1 %}
data-force-redirect="true"
{% endif %}
{% if hideAddress is defined and hideAddress == 1 %} {% if hideAddress is defined and hideAddress == 1 %}
data-hide-address="true" data-hide-address="true"
{% endif %} {% endif %}

View File

@ -29,9 +29,11 @@
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id }, targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
openPanesInModal: false, openPanesInModal: false,
} %} } %}
{#
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
#}
{% endblock %} {% endblock %}

View File

@ -29,10 +29,10 @@
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id }, targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
stickyActions: true, stickyActions: true,
} %} } %}
{# {#
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
openPanesInModal: false, openPanesInModal: false,
useValidFrom: true, useValidFrom: true,
#} #}

View File

@ -9,12 +9,10 @@
{# include vue_address component #} {# include vue_address component #}
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
stickyActions: true
} %}
{#
backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), backUrl: path('chill_person_household_addresses', { 'household_id': household.id }),
stickyActions: true,
openPanesInModal: false, openPanesInModal: false,
#} } %}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -10,12 +10,9 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), backUrl: path('chill_person_household_addresses', { 'household_id': household.id }),
forceRedirect: true, openPanesInModal: false,
stickyActions: true, stickyActions: true,
} %} } %}
{#
openPanesInModal: false,
#}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -18,14 +18,13 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
backUrl: path('chill_person_household_addresses', { 'household_id': household.id }), backUrl: path('chill_person_household_addresses', { 'household_id': household.id }),
forceRedirect: true,
mode: 'new', mode: 'new',
useValidFrom: true,
buttonSize: 'btn-lg', buttonSize: 'btn-lg',
buttonText: 'Move household', buttonText: 'Move household',
modalTitle: 'Move household', modalTitle: 'Move household',
} %} } %}
{# {#
useValidFrom: true,
#} #}
</li> </li>
@ -68,8 +67,6 @@
}) }} }) }}
<ul class="record_actions"> <ul class="record_actions">
<li> <li>
{# include vue_address component #}
<a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}" <a href="{{ path('chill_person_household_address_edit', { 'household_id': household.id, 'address_id' : address.id } ) }}"
class="btn btn-edit"></a> class="btn btn-edit"></a>

View File

@ -32,7 +32,6 @@
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with { {% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'household', id: household.id }, targetEntity: { name: 'household', id: household.id },
backUrl: path('chill_person_household_summary', { 'household_id': household.id }), backUrl: path('chill_person_household_summary', { 'household_id': household.id }),
forceRedirect: true,
hideAddress: true, hideAddress: true,
mode: 'new', mode: 'new',
buttonSize: 'btn-sm', buttonSize: 'btn-sm',