2020-10-24 12:50:08 -07:00
|
|
|
<template>
|
2021-08-29 01:40:37 -07:00
|
|
|
<ListInput v-model="v" :prototype="{key: '', value: 0}" :group="group">
|
|
|
|
<template v-slot="s">
|
2021-10-29 08:08:41 -07:00
|
|
|
<button type="button" :class="['btn', parseInt(s.val.value) === 1 ? 'btn-primary' : 'btn-outline-secondary', 'btn-thin']"
|
2021-08-29 01:40:37 -07:00
|
|
|
:aria-label="$t('profile.opinion.yes')"
|
|
|
|
@click="s.update({key: s.val.key, value: 1})">
|
2021-10-29 07:48:01 -07:00
|
|
|
<Tooltip :text="$t('profile.opinion.yes')">
|
|
|
|
<Icon v="heart"/>
|
|
|
|
</Tooltip>
|
2021-08-29 01:40:37 -07:00
|
|
|
</button>
|
2021-10-29 08:08:41 -07:00
|
|
|
<button type="button" :class="['btn', parseInt(s.val.value) === 2 ? 'btn-primary' : 'btn-outline-secondary', 'btn-thin']"
|
2021-08-29 01:40:37 -07:00
|
|
|
:aria-label="$t('profile.opinion.jokingly')"
|
|
|
|
@click="s.update({key: s.val.key, value: 2})">
|
2021-10-29 07:48:01 -07:00
|
|
|
<Tooltip :text="$t('profile.opinion.jokingly')">
|
|
|
|
<Icon v="grin-tongue"/>
|
|
|
|
</Tooltip>
|
2021-08-29 01:40:37 -07:00
|
|
|
</button>
|
2021-10-29 08:08:41 -07:00
|
|
|
<button type="button" :class="['btn', parseInt(s.val.value) === 3 ? 'btn-primary' : 'btn-outline-secondary', 'btn-thin']"
|
|
|
|
:aria-label="$t('profile.opinion.close')"
|
|
|
|
@click="s.update({key: s.val.key, value: 3})">
|
|
|
|
<Tooltip :text="$t('profile.opinion.close')">
|
|
|
|
<Icon v="user-friends"/>
|
|
|
|
</Tooltip>
|
|
|
|
</button>
|
|
|
|
<button type="button" :class="['btn', parseInt(s.val.value) === 0 ? 'btn-primary' : 'btn-outline-secondary', 'btn-thin']"
|
2021-08-29 01:40:37 -07:00
|
|
|
:aria-label="$t('profile.opinion.meh')"
|
|
|
|
@click="s.update({key: s.val.key, value: 0})">
|
2021-10-29 07:48:01 -07:00
|
|
|
<Tooltip :text="$t('profile.opinion.meh')">
|
|
|
|
<Icon v="thumbs-up"/>
|
|
|
|
</Tooltip>
|
2021-08-29 01:40:37 -07:00
|
|
|
</button>
|
2021-10-29 08:08:41 -07:00
|
|
|
<button type="button" :class="['btn', parseInt(s.val.value) === -1 ? 'btn-primary' : 'btn-outline-secondary', 'btn-thin']"
|
2021-08-29 01:40:37 -07:00
|
|
|
:aria-label="$t('profile.opinion.no')"
|
|
|
|
@click="s.update({key: s.val.key, value: -1})">
|
2021-10-29 07:48:01 -07:00
|
|
|
<Tooltip :text="$t('profile.opinion.no')">
|
|
|
|
<Icon v="thumbs-down"/>
|
|
|
|
</Tooltip>
|
2021-08-29 01:40:37 -07:00
|
|
|
</button>
|
|
|
|
<input v-model="s.val.key" :class="['form-control', 'mw-input', invalid(s.val) ? 'border-danger' : '']" @keyup="s.update(s.val)" required/>
|
|
|
|
</template>
|
|
|
|
<template v-slot:validation="s">
|
|
|
|
<p v-if="invalid(s.val)" class="small text-danger">
|
|
|
|
<Icon v="exclamation-triangle"/>
|
|
|
|
<span class="ml-1">{{$t(validation(s.val.key))}}</span>
|
|
|
|
</p>
|
|
|
|
</template>
|
2020-10-24 12:50:08 -07:00
|
|
|
</ListInput>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2020-10-25 04:30:55 -07:00
|
|
|
props: {
|
|
|
|
value: {},
|
|
|
|
group: {},
|
2020-11-05 05:06:47 -08:00
|
|
|
validation: {},
|
2020-10-25 04:30:55 -07:00
|
|
|
},
|
2020-10-24 12:50:08 -07:00
|
|
|
data() { return { v: this.value } },
|
2021-11-15 11:55:59 -08:00
|
|
|
watch: {
|
|
|
|
v() { this.$emit('input', this.v); },
|
|
|
|
value(v) { this.v = v; }
|
|
|
|
},
|
2021-08-29 01:40:37 -07:00
|
|
|
methods: {
|
|
|
|
invalid(val) {
|
|
|
|
return this.validation && val.key && this.validation(val.key)
|
|
|
|
},
|
|
|
|
},
|
2020-10-24 12:50:08 -07:00
|
|
|
}
|
|
|
|
</script>
|
2021-10-29 08:08:41 -07:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
@import "assets/style";
|
|
|
|
|
|
|
|
@include media-breakpoint-down('sm', $grid-breakpoints) {
|
|
|
|
.btn-thin {
|
|
|
|
padding-left: map-get($spacers, 1) !important;
|
|
|
|
padding-right: map-get($spacers, 1) !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|