mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-04-06 01:25:31 +00:00
Refines slider functions
- Co-Authored-By: Mogge <moriz.wahl@gmx.de>
This commit is contained in:
parent
e57533fcec
commit
e50728e4db
@ -5,21 +5,22 @@
|
|||||||
<ds-flex>
|
<ds-flex>
|
||||||
<ds-flex-item>
|
<ds-flex-item>
|
||||||
<div
|
<div
|
||||||
v-for="slider in sliderData.sliders"
|
v-for="(slider, index) in sliderData.sliders"
|
||||||
:key="slider.name"
|
:key="slider.name"
|
||||||
class="selection-button"
|
class="selection-button"
|
||||||
:class="['Sliders__component-selection']"
|
:class="[
|
||||||
|
'Sliders__component-selection',
|
||||||
|
sliderIndexByName(slider.name) < sliderIndex && '--confirmed',
|
||||||
|
]"
|
||||||
>
|
>
|
||||||
<base-button
|
<base-button
|
||||||
:class="[sliderIndexByName(slider.name) >= sliderIndex && '--disabled']"
|
|
||||||
style="float: left"
|
style="float: left"
|
||||||
:icon="slider.validated && slider.confirmed && 'check'"
|
|
||||||
:circle="true"
|
:circle="true"
|
||||||
size="small"
|
size="small"
|
||||||
type="submit"
|
type="submit"
|
||||||
filled
|
filled
|
||||||
:loading="false"
|
:loading="false"
|
||||||
:disabled="!(slider.confirmed || sliderIndexByName(slider.name) === sliderIndex)"
|
:disabled="index > sliderIndex"
|
||||||
@click="sliderData.sliderSelectorCallback(slider.name)"
|
@click="sliderData.sliderSelectorCallback(slider.name)"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -31,10 +32,10 @@
|
|||||||
type="submit"
|
type="submit"
|
||||||
filled
|
filled
|
||||||
:loading="false"
|
:loading="false"
|
||||||
:disabled="sliderData.button.disabled"
|
:disabled="!sliderData.sliders[sliderIndex].validated"
|
||||||
@click="sliderData.button.callback"
|
@click="sliderData.sliders[sliderIndex].button.callback"
|
||||||
>
|
>
|
||||||
{{ sliderData.button.title }}
|
{{ sliderData.sliders[sliderIndex].button.title }}
|
||||||
</base-button>
|
</base-button>
|
||||||
</ds-flex-item>
|
</ds-flex-item>
|
||||||
</ds-flex>
|
</ds-flex>
|
||||||
@ -61,10 +62,6 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
// Wolle .pointer {
|
|
||||||
// cursor: pointer;
|
|
||||||
// }
|
|
||||||
|
|
||||||
.Sliders {
|
.Sliders {
|
||||||
// Wolle position: relative;
|
// Wolle position: relative;
|
||||||
// background-color: #fff;
|
// background-color: #fff;
|
||||||
@ -88,7 +85,7 @@ export default {
|
|||||||
// &.--active {
|
// &.--active {
|
||||||
// border-bottom: 2px solid #17b53f;
|
// border-bottom: 2px solid #17b53f;
|
||||||
// }
|
// }
|
||||||
&.--disabled {
|
&.--confirmed {
|
||||||
opacity: $opacity-disabled;
|
opacity: $opacity-disabled;
|
||||||
// &:hover {
|
// &:hover {
|
||||||
// border-bottom: none;
|
// border-bottom: none;
|
||||||
|
|||||||
@ -31,13 +31,14 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
formData: {
|
formData: {
|
||||||
|
// inviteCode: this.handleInputOnStart(this.inviteCode),
|
||||||
inviteCode: this.inviteCode ? this.inviteCode : '',
|
inviteCode: this.inviteCode ? this.inviteCode : '',
|
||||||
},
|
},
|
||||||
formSchema: {
|
formSchema: {
|
||||||
inviteCode: {
|
inviteCode: {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
min: 5,
|
min: 6,
|
||||||
max: 5,
|
max: 6,
|
||||||
required: true,
|
required: true,
|
||||||
message: this.$t('components.enter-invite.form.validations.length'),
|
message: this.$t('components.enter-invite.form.validations.length'),
|
||||||
},
|
},
|
||||||
@ -52,6 +53,8 @@ export default {
|
|||||||
async handleInputValid() {
|
async handleInputValid() {
|
||||||
// Wolle console.log('handleInputValid !!!')
|
// Wolle console.log('handleInputValid !!!')
|
||||||
const { inviteCode } = this.formData
|
const { inviteCode } = this.formData
|
||||||
|
// validate in backend
|
||||||
|
// toaster
|
||||||
this.sliderData.validateCallback(true, { /* email, */inviteCode })
|
this.sliderData.validateCallback(true, { /* email, */inviteCode })
|
||||||
},
|
},
|
||||||
handleSubmitVerify() {
|
handleSubmitVerify() {
|
||||||
@ -60,6 +63,14 @@ export default {
|
|||||||
// this.$emit('nonceEntered', { email, nonce })
|
// this.$emit('nonceEntered', { email, nonce })
|
||||||
// this.$emit('validation', { email, nonce })
|
// this.$emit('validation', { email, nonce })
|
||||||
},
|
},
|
||||||
|
// async handleInputOnStart(inviteCode) {
|
||||||
|
// if (inviteCode) {
|
||||||
|
// await this.handleInputValid()
|
||||||
|
// return inviteCode
|
||||||
|
// } else {
|
||||||
|
// return ''
|
||||||
|
// }
|
||||||
|
// },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -18,18 +18,19 @@
|
|||||||
</registration-item-enter-invite>
|
</registration-item-enter-invite>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #create-user-account>
|
<!-- <template #enter-email> -->
|
||||||
<!-- Wolle !!! may create same source with 'webapp/pages/registration/signup.vue' -->
|
<!-- Wolle !!! may create same source with 'webapp/pages/registration/signup.vue' -->
|
||||||
<signup v-if="publicRegistration" :invitation="false" @submit="handleSubmitted">
|
<!-- <signup v-if="publicRegistration" :invitation="false" @submit="handleSubmitted"> -->
|
||||||
|
<!-- <signup :invitation="false" @submit="handleSubmitted">
|
||||||
<ds-space centered margin-top="large">
|
<ds-space centered margin-top="large">
|
||||||
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
|
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
|
||||||
</ds-space>
|
</ds-space>
|
||||||
</signup>
|
</signup> -->
|
||||||
<ds-space v-else centered>
|
<!-- <ds-space v-else centered>
|
||||||
<hc-empty icon="events" :message="$t('components.registration.signup.unavailable')" />
|
<hc-empty icon="events" :message="$t('components.registration.signup.unavailable')" />
|
||||||
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
|
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
|
||||||
</ds-space>
|
</ds-space> -->
|
||||||
</template>
|
<!-- </template> -->
|
||||||
|
|
||||||
<template #create-user-account>
|
<template #create-user-account>
|
||||||
<registration-item-create-user-account
|
<registration-item-create-user-account
|
||||||
@ -67,11 +68,6 @@ export default {
|
|||||||
RegistrationItemCreateUserAccount,
|
RegistrationItemCreateUserAccount,
|
||||||
Signup,
|
Signup,
|
||||||
},
|
},
|
||||||
// Wolle props: {
|
|
||||||
// id: { type: String },
|
|
||||||
// loading: { type: Boolean, default: false },
|
|
||||||
// options: { type: Array, default: () => [] },
|
|
||||||
// },
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
links,
|
links,
|
||||||
@ -81,36 +77,39 @@ export default {
|
|||||||
inviteCode: null,
|
inviteCode: null,
|
||||||
email: null,
|
email: null,
|
||||||
},
|
},
|
||||||
|
// sliderIndex: 0,
|
||||||
sliders: [
|
sliders: [
|
||||||
{
|
{
|
||||||
name: 'enter-invite',
|
name: 'enter-invite',
|
||||||
active: true,
|
|
||||||
validated: false,
|
validated: false,
|
||||||
confirmed: false,
|
button: {
|
||||||
|
title: 'Next', // Wolle
|
||||||
|
callback: this.buttonCallback,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// name: 'enter-email',
|
||||||
|
// validated: false,
|
||||||
|
// button: {
|
||||||
|
// title: 'Next', // Wolle
|
||||||
|
// callback: this.buttonCallback,
|
||||||
|
// },
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
name: 'create-user-account',
|
name: 'create-user-account',
|
||||||
active: false,
|
|
||||||
validated: false,
|
validated: false,
|
||||||
confirmed: false,
|
button: {
|
||||||
|
title: this.$t('actions.save'), // Wolle
|
||||||
|
callback: this.buttonCallback,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
activeSliderName: 'enter-invite',
|
activeSliderName: 'enter-invite',
|
||||||
sliderSelectorCallback: this.sliderSelectorCallback,
|
sliderSelectorCallback: this.sliderSelectorCallback,
|
||||||
validateCallback: this.validateCallback,
|
validateCallback: this.validateCallback,
|
||||||
button: {
|
|
||||||
title: 'Next', // Wolle
|
|
||||||
disabled: true,
|
|
||||||
callback: this.buttonCallback,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
asyncData({ app }) {
|
|
||||||
return {
|
|
||||||
publicRegistration: app.$env.PUBLIC_REGISTRATION === 'true',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
sliderIndex() {
|
sliderIndex() {
|
||||||
return this.sliderIndexByName(this.sliderData.activeSliderName)
|
return this.sliderIndexByName(this.sliderData.activeSliderName)
|
||||||
@ -121,41 +120,25 @@ export default {
|
|||||||
return this.sliderData.sliders.findIndex((slider) => slider.name === name)
|
return this.sliderData.sliders.findIndex((slider) => slider.name === name)
|
||||||
},
|
},
|
||||||
validateCallback(is, data = null) {
|
validateCallback(is, data = null) {
|
||||||
this.sliderData.sliders[this.sliderIndex].validated = is
|
|
||||||
|
|
||||||
if (is) {
|
if (is) {
|
||||||
this.sliderData.collectedComponentData = {
|
this.sliderData.collectedComponentData = {
|
||||||
...this.sliderData.collectedComponentData,
|
...this.sliderData.collectedComponentData,
|
||||||
...data,
|
...data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.sliderData.button.disabled = !is
|
this.sliderData.sliders[this.sliderIndex].validated = is
|
||||||
},
|
},
|
||||||
sliderSelectorCallback(sliderName) {
|
sliderSelectorCallback(sliderName) {
|
||||||
// if (this.sliderIndexByName(sliderName) < this.sliderIndex) {
|
if (this.sliderIndexByName(sliderName) < this.sliderIndex) {
|
||||||
// this.sliderData.activeSliderName = sliderName
|
|
||||||
// }
|
|
||||||
// console.log('sliderName: ', sliderName)
|
|
||||||
// console.log('this.sliderIndexByName(sliderName): ', this.sliderIndexByName(sliderName))
|
|
||||||
// console.log('this.sliderData.sliders[this.sliderIndexByName(sliderName)].active: ', this.sliderData.sliders[this.sliderIndexByName(sliderName)].active)
|
|
||||||
if (this.sliderData.sliders[this.sliderIndexByName(sliderName)].active) {
|
|
||||||
this.sliderData.activeSliderName = sliderName
|
this.sliderData.activeSliderName = sliderName
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
buttonCallback() {
|
buttonCallback() {
|
||||||
this.sliderData.sliders[this.sliderIndex].confirmed = true
|
|
||||||
// this.sliderData.sliders[this.sliderIndex].active = true
|
|
||||||
|
|
||||||
if (this.sliderIndex === this.sliderData.sliders.length - 1) {
|
if (this.sliderIndex === this.sliderData.sliders.length - 1) {
|
||||||
// console.log('submit data: ', this.sliderData.collectedComponentData)
|
// console.log('submit data: ', this.sliderData.collectedComponentData)
|
||||||
} else {
|
} else {
|
||||||
if (this.sliderIndex < this.sliderData.sliders.length - 1) {
|
if (this.sliderIndex < this.sliderData.sliders.length - 1) {
|
||||||
this.sliderData.activeSliderName = this.sliderData.sliders[this.sliderIndex + 1].name
|
this.sliderData.activeSliderName = this.sliderData.sliders[this.sliderIndex + 1].name
|
||||||
this.sliderData.sliders[this.sliderIndex].active = true
|
|
||||||
this.sliderData.button.disabled = true
|
|
||||||
}
|
|
||||||
if (this.sliderIndex === this.sliderData.sliders.length - 1) {
|
|
||||||
this.sliderData.button.title = this.$t('actions.save') // Wolle
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user