From 0022ea73653ba464c58f0949c481d920b6042056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sat, 27 Feb 2021 18:04:23 +0100 Subject: [PATCH] Move in 'setSliderValuesCallback' 'slotOnNextClick' as 'buttonSliderCallback' into 'sliderSettings' --- .../ComponentSlider/ComponentSlider.vue | 8 ++-- .../RegistrationItemCreateUserAccount.vue | 5 ++- .../RegistrationItemEnterEmail.vue | 11 ++--- .../RegistrationItemEnterInvite.vue | 4 +- .../RegistrationItemEnterNonce.vue | 4 +- .../Registration/RegistrationSlider.vue | 42 +++++++------------ 6 files changed, 33 insertions(+), 41 deletions(-) diff --git a/webapp/components/ComponentSlider/ComponentSlider.vue b/webapp/components/ComponentSlider/ComponentSlider.vue index d01520858..ce5000d53 100644 --- a/webapp/components/ComponentSlider/ComponentSlider.vue +++ b/webapp/components/ComponentSlider/ComponentSlider.vue @@ -36,7 +36,7 @@ filled :loading="false" :disabled="!sliderData.sliders[sliderIndex].validated" - @click="onClick" + @click="onNextClick" > {{ sliderData.sliders[sliderIndex].button.title }} @@ -59,10 +59,10 @@ export default { }, }, methods: { - async onClick() { + async onNextClick() { let success = true - if (this.sliderData.sliders[this.sliderIndex].button.slotOnNextClick) { - success = await this.sliderData.sliders[this.sliderIndex].button.slotOnNextClick() + if (this.sliderData.sliders[this.sliderIndex].button.sliderCallback) { + success = await this.sliderData.sliders[this.sliderIndex].button.sliderCallback() } success = success && this.sliderData.sliders[this.sliderIndex].button.callback(success) if (success && this.sliderIndex < this.sliderData.sliders.length - 1) { diff --git a/webapp/components/Registration/RegistrationItemCreateUserAccount.vue b/webapp/components/Registration/RegistrationItemCreateUserAccount.vue index ed8ed8576..a8608f817 100644 --- a/webapp/components/Registration/RegistrationItemCreateUserAccount.vue +++ b/webapp/components/Registration/RegistrationItemCreateUserAccount.vue @@ -227,8 +227,9 @@ export default { : false this.sendValidation() - // Wolle this.sliderData.setSliderValuesCallback(this.validInput, {}, {}, this.onNextClick) - this.sliderData.setSliderValuesCallback(this.valid, {}, this.onNextClick) + this.sliderData.setSliderValuesCallback(this.valid, { + sliderSettings: { buttonSliderCallback: this.onNextClick }, + }) }) }, computed: { diff --git a/webapp/components/Registration/RegistrationItemEnterEmail.vue b/webapp/components/Registration/RegistrationItemEnterEmail.vue index f15448a23..0130d2dcc 100644 --- a/webapp/components/Registration/RegistrationItemEnterEmail.vue +++ b/webapp/components/Registration/RegistrationItemEnterEmail.vue @@ -133,11 +133,12 @@ export default { : '' this.sendValidation() - this.sliderData.setSliderValuesCallback( - this.validInput, - this.buttonValues(), - this.onNextClick, - ) + this.sliderData.setSliderValuesCallback(this.validInput, { + sliderSettings: { + ...this.buttonValues().sliderSettings, + buttonSliderCallback: this.onNextClick, + }, + }) }) }, watch: { diff --git a/webapp/components/Registration/RegistrationItemEnterInvite.vue b/webapp/components/Registration/RegistrationItemEnterInvite.vue index cb5e1deb5..e0548315b 100644 --- a/webapp/components/Registration/RegistrationItemEnterInvite.vue +++ b/webapp/components/Registration/RegistrationItemEnterInvite.vue @@ -57,7 +57,9 @@ export default { : '' this.sendValidation() - this.sliderData.setSliderValuesCallback(this.validInput, {}, this.onNextClick) + this.sliderData.setSliderValuesCallback(this.validInput, { + sliderSettings: { buttonSliderCallback: this.onNextClick }, + }) }) }, computed: { diff --git a/webapp/components/Registration/RegistrationItemEnterNonce.vue b/webapp/components/Registration/RegistrationItemEnterNonce.vue index 9acc70baf..b93f36be7 100644 --- a/webapp/components/Registration/RegistrationItemEnterNonce.vue +++ b/webapp/components/Registration/RegistrationItemEnterNonce.vue @@ -62,7 +62,9 @@ export default { this.sendValidation() // Wolle this.sliderData.setSliderValuesCallback(this.validInput, {}, {}, this.onNextClick) - this.sliderData.setSliderValuesCallback(this.valid, {}, this.onNextClick) + this.sliderData.setSliderValuesCallback(this.valid, { + sliderSettings: { buttonSliderCallback: this.onNextClick }, + }) }) }, computed: { diff --git a/webapp/components/Registration/RegistrationSlider.vue b/webapp/components/Registration/RegistrationSlider.vue index 466409462..d58e6b809 100644 --- a/webapp/components/Registration/RegistrationSlider.vue +++ b/webapp/components/Registration/RegistrationSlider.vue @@ -92,7 +92,7 @@ export default { title: 'Next', // Wolle icon: 'arrow-right', callback: this.buttonCallback, - slotOnNextClick: null, // optional set by slot + sliderCallback: null, // optional set by slot }, }, { @@ -104,7 +104,7 @@ export default { title: '', // set by slider component icon: '', // set by slider component callback: this.buttonCallback, - slotOnNextClick: null, // optional set by slot + sliderCallback: null, // optional set by slot }, }, { @@ -116,7 +116,7 @@ export default { title: 'Confirm', // Wolle icon: 'arrow-right', callback: this.buttonCallback, - slotOnNextClick: null, // optional set by slot + sliderCallback: null, // optional set by slot }, }, { @@ -129,7 +129,7 @@ export default { title: 'Create', // Wolle icon: 'check', callback: this.buttonCallback, - slotOnNextClick: null, // optional set by slot + sliderCallback: null, // optional set by slot }, }, ] @@ -186,18 +186,9 @@ export default { }, }, methods: { - // Wolle enterEmailButtonTitle(emailSend) { - // // return emailSend ? 'Resend e-mail' : 'Send e-mail' - // return emailSend ? 'Skip resend' : 'Send e-mail' // Wolle - // }, - // enterEmailButtonIcon(emailSend) { - // // return emailSend ? 'Resend e-mail' : 'Send e-mail' - // return emailSend ? 'arrow-right' : 'envelope' // Wolle - // }, setSliderValuesCallback( isValid, - { collectedInputData, sliderData, sliderSettings }, - slotOnNextClick = null, + { collectedInputData, sliderData, sliderSettings }, // sliderCallback = null, ) { this.sliderData.sliders[this.sliderIndex].validated = isValid @@ -220,37 +211,32 @@ export default { } } if (sliderSettings) { - const { buttonTitle, buttonIcon } = sliderSettings + const { buttonTitle, buttonIcon, buttonSliderCallback } = sliderSettings if (buttonTitle) { this.sliderData.sliders[this.sliderIndex].button.title = buttonTitle } if (buttonIcon) { this.sliderData.sliders[this.sliderIndex].button.icon = buttonIcon } + if (buttonSliderCallback) { + this.sliderData.sliders[this.sliderIndex].button.sliderCallback = buttonSliderCallback + } } - if (slotOnNextClick) { - this.sliderData.sliders[this.sliderIndex].button.slotOnNextClick = slotOnNextClick - } + // Wolle if (sliderCallback) { + // this.sliderData.sliders[this.sliderIndex].button.sliderCallback = sliderCallback + // } }, sliderSelectorCallback(selectedIndex) { if (selectedIndex <= this.sliderIndex + 1 && selectedIndex < this.sliderData.sliders.length) { - // Wolle if (this.sliderData.sliders[this.sliderIndex].name === 'enter-email') { - // this.sliderData.sliders[this.sliderIndex].button.title = this.enterEmailButtonTitle( - // this.sliderData.collectedInputData.emailSend, - // ) - // this.sliderData.sliders[this.sliderIndex].button.icon = this.enterEmailButtonIcon( - // this.sliderData.collectedInputData.emailSend, - // ) - // } this.sliderData.sliderIndex = selectedIndex } }, buttonCallback(success) { // Wolle // if (this.sliderData.sliders[this.sliderIndex].name === 'enter-email') { - // // if (this.sliderData.sliders[this.sliderIndex].button.slotOnNextClick) { - // // this.sliderData.sliders[this.sliderIndex].button.slotOnNextClick() + // // if (this.sliderData.sliders[this.sliderIndex].button.sliderCallback) { + // // this.sliderData.sliders[this.sliderIndex].button.sliderCallback() // // } // this.sliderData.sliders[this.sliderIndex].button.title = this.enterEmailButtonTitle( // this.sliderData.collectedInputData.emailSend,