mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
addAddress: improve boolean variables
This commit is contained in:
parent
a5ceb551eb
commit
da32afeb3f
@ -187,6 +187,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
step1WithModal() {
|
||||
console.log('options displayText', this.options.button.displayText);
|
||||
console.log('options bindModal.step1', this.options.bindModal.step1);
|
||||
console.log('options bindModal.step2', this.options.bindModal.step2);
|
||||
return (this.options.bindModal !== null && typeof this.options.bindModal.step1 !== 'undefined') ?
|
||||
this.options.bindModal.step1 : this.default.bindModal.step1;
|
||||
},
|
||||
|
@ -7,25 +7,25 @@ const i18n = _createI18n( addressMessages );
|
||||
|
||||
let containers = document.querySelectorAll('.address-container');
|
||||
containers.forEach((container) => {
|
||||
|
||||
const app = createApp({
|
||||
template: `<app v-bind:addAddress="this.addAddress" ></app>`,
|
||||
data() {
|
||||
return {
|
||||
addAddress: {
|
||||
context: {
|
||||
edit: container.dataset.mode === 'edit',
|
||||
entity: {
|
||||
type: container.dataset.targetEntityName,
|
||||
id: container.dataset.targetEntityId
|
||||
},
|
||||
addressId: container.dataset.addressId | null,
|
||||
backUrl: container.dataset.backUrl,
|
||||
edit: container.dataset.mode === 'edit', //boolean
|
||||
addressId: container.dataset.addressId || null,
|
||||
backUrl: container.dataset.backUrl || null,
|
||||
valid: {
|
||||
from: new Date()
|
||||
},
|
||||
},
|
||||
options: {
|
||||
|
||||
/// Options override default.
|
||||
/// null value take default component value defined in AddAddress data()
|
||||
button: {
|
||||
@ -34,19 +34,17 @@ containers.forEach((container) => {
|
||||
edit: container.dataset.buttonText || null
|
||||
},
|
||||
size: container.dataset.buttonSize || null,
|
||||
displayText: container.dataset.buttonDisplayText //boolean, default: true
|
||||
displayText: container.dataset.buttonDisplayText !== 'false' //boolean, default: true
|
||||
},
|
||||
|
||||
/// Modal title text if create or edit address (trans chain, see i18n)
|
||||
title: {
|
||||
create: container.dataset.modalTitle || null,
|
||||
edit: container.dataset.modalTitle || null
|
||||
},
|
||||
|
||||
/// Display each step in page or Modal
|
||||
bindModal: {
|
||||
step1: container.dataset.bindModalStep1, //boolean, default: true
|
||||
step2: container.dataset.bindModalStep2 //boolean, default: true
|
||||
step1: container.dataset.bindModalStep1 !== 'false', //boolean, default: true
|
||||
step2: container.dataset.bindModalStep2 !== 'false' //boolean, default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,16 +47,16 @@
|
||||
data-button-size="{{ buttonSize|e('html_attr') }}"
|
||||
{% endif %}
|
||||
|
||||
{% if buttonDisplayText is defined and buttonDisplayText == false %}
|
||||
data-button-display-text=false
|
||||
{% if buttonDisplayText is defined and buttonDisplayText != 1 %}
|
||||
data-button-display-text="false"
|
||||
{% endif %}
|
||||
|
||||
{% if bindModalStep1 is defined and bindModalStep1 == false %}
|
||||
data-bind-modal-step1=false
|
||||
{% if bindModalStep1 is defined and bindModalStep1 != 1 %}
|
||||
data-bind-modal-step1="false"
|
||||
{% endif %}
|
||||
|
||||
{% if bindModalStep2 is defined and bindModalStep2 == false %}
|
||||
data-bind-modal-step2=false
|
||||
{% if bindModalStep2 is defined and bindModalStep2 != 1 %}
|
||||
data-bind-modal-step2="false"
|
||||
{% endif %}
|
||||
></div>
|
||||
|
||||
|
@ -37,8 +37,12 @@
|
||||
buttonSize: 'btn-sm',
|
||||
buttonText: 'Move household',
|
||||
modalTitle: 'Move household',
|
||||
buttonDisplayText: false
|
||||
buttonDisplayText: false,
|
||||
} %}
|
||||
{#
|
||||
bindModalStep1: false,
|
||||
bindModalStep2: true,
|
||||
#}
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<a class="btn btn-secondary btn-sm" title="{{ "Addresses history"|trans }}"
|
||||
|
Loading…
x
Reference in New Issue
Block a user