2020-11-17 10:21:49 -08:00
|
|
|
<template>
|
2021-07-25 00:50:02 -07:00
|
|
|
<section v-if="$user()">
|
2020-11-17 10:21:49 -08:00
|
|
|
<div v-if="afterSubmit" class="alert alert-success text-center">
|
|
|
|
<p>
|
|
|
|
<T>nouns.submit.thanks</T>
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<button class="btn btn-success" @click="afterSubmit = false">
|
|
|
|
<Icon v="plus"/>
|
|
|
|
<T>nouns.submit.another</T>
|
|
|
|
</button>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<form v-else @submit.prevent="submit">
|
2021-07-03 04:30:29 -07:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-12 col-lg-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="text-nowrap"><strong>
|
2020-11-17 10:21:49 -08:00
|
|
|
<Icon v="comment-times"/>
|
2021-08-28 14:44:30 -07:00
|
|
|
<T>inclusive.insteadOf</T>
|
2021-07-03 04:30:29 -07:00
|
|
|
</strong></label>
|
|
|
|
<NounForm v-model="form.insteadOf" maxlength="128"/>
|
2022-05-20 05:29:18 -07:00
|
|
|
|
|
|
|
<div class="mt-2">
|
|
|
|
<label>
|
|
|
|
<input class="form-check-input" type="checkbox" v-model="clarification">
|
|
|
|
<T>inclusive.clarification</T>
|
|
|
|
</label>
|
|
|
|
<input class="form-control" v-model="form.clarification" v-show="clarification"/>
|
|
|
|
</div>
|
2021-07-03 04:30:29 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="col-12 col-lg-6">
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="text-nowrap"><strong>
|
2020-11-17 10:21:49 -08:00
|
|
|
<Icon v="comment-check"/>
|
2021-08-28 14:44:30 -07:00
|
|
|
<T>inclusive.say</T>
|
2021-07-03 04:30:29 -07:00
|
|
|
</strong></label>
|
|
|
|
<NounForm v-model="form.say" maxlength="128"/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
<label class="text-nowrap"><strong>
|
|
|
|
<Icon v="comment-dots"/>
|
2021-08-28 14:44:30 -07:00
|
|
|
<T>inclusive.because</T>
|
2021-07-03 04:30:29 -07:00
|
|
|
</strong></label>
|
|
|
|
<textarea v-model="form.because" class="form-control form-control-sm" required rows="6"></textarea>
|
2020-11-17 10:21:49 -08:00
|
|
|
</div>
|
2020-12-03 06:01:26 -08:00
|
|
|
|
|
|
|
<div class="form-group">
|
2021-12-02 08:18:25 -08:00
|
|
|
<label><strong><T>inclusive.categories</T><T>quotation.colon</T></strong></label>
|
2021-08-28 14:44:30 -07:00
|
|
|
<a v-for="category in config.inclusive.categories"
|
2021-05-18 09:53:07 -07:00
|
|
|
href="#" :class="['badge border mx-1 text-decoration-none', form.categories.includes(category) ? 'bg-primary text-white' : 'bg-light text-primary']"
|
2020-12-03 06:01:26 -08:00
|
|
|
@click.prevent="form.categories = form.categories.includes(category) ? form.categories.filter(c => c !== category) : [...form.categories, category]"
|
|
|
|
>
|
|
|
|
{{ category }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="form-group">
|
2021-12-02 08:18:25 -08:00
|
|
|
<label><strong><T>inclusive.sources</T><T>quotation.colon</T></strong></label>
|
2020-12-03 06:01:26 -08:00
|
|
|
<ListInput v-model="form.links" v-slot="s">
|
|
|
|
<input v-model="s.val" type="url" class="form-control" @keyup="s.update(s.val)" required/>
|
|
|
|
</ListInput>
|
|
|
|
</div>
|
|
|
|
|
2020-11-17 10:21:49 -08:00
|
|
|
<div class="alert alert-info" v-if="form.base">
|
|
|
|
<Icon v="info-circle"/>
|
|
|
|
<T>nouns.editing</T>
|
2021-01-22 14:54:24 -08:00
|
|
|
<button class="btn btn-sm float-end" @click="form.base = null">
|
2020-11-17 10:21:49 -08:00
|
|
|
<Icon v="times"/>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
2021-01-22 14:54:24 -08:00
|
|
|
<button class="btn btn-primary w-100" :disabled="submitting">
|
2020-11-17 10:21:49 -08:00
|
|
|
<template v-if="submitting">
|
|
|
|
<Icon v="circle-notch fa-spin"/>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<Icon v="plus"/>
|
|
|
|
<T>nouns.submit.actionLong</T>
|
|
|
|
</template>
|
|
|
|
</button>
|
|
|
|
<p class="small text-muted mt-1"><T>nouns.submit.moderation</T></p>
|
|
|
|
</form>
|
|
|
|
</section>
|
2021-07-25 00:50:02 -07:00
|
|
|
<section v-else class="text-center">
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<T>crud.loginRequired</T>
|
|
|
|
</div>
|
|
|
|
</section>
|
2020-11-17 10:21:49 -08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
form: {
|
|
|
|
insteadOf: [''],
|
|
|
|
say: [''],
|
|
|
|
because: '',
|
2020-12-03 06:01:26 -08:00
|
|
|
categories: [],
|
|
|
|
links: [],
|
2022-05-20 05:29:18 -07:00
|
|
|
clarification: null,
|
2020-11-17 10:21:49 -08:00
|
|
|
base: null,
|
|
|
|
},
|
|
|
|
submitting: false,
|
|
|
|
afterSubmit: false,
|
2022-05-20 05:29:18 -07:00
|
|
|
clarification: false,
|
2020-11-17 10:21:49 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async submit(event) {
|
|
|
|
this.submitting = true;
|
2021-06-09 09:06:32 -07:00
|
|
|
try {
|
|
|
|
await this.$post(`/inclusive/submit`, this.form);
|
|
|
|
this.afterSubmit = true;
|
|
|
|
this.form = {
|
|
|
|
insteadOf: [''],
|
|
|
|
say: [''],
|
|
|
|
because: '',
|
|
|
|
categories: [],
|
|
|
|
links: [],
|
2022-05-20 05:29:18 -07:00
|
|
|
clarification: null,
|
2021-06-09 09:06:32 -07:00
|
|
|
base: null,
|
|
|
|
};
|
2022-05-20 05:29:18 -07:00
|
|
|
this.clarification = false;
|
2021-06-09 09:06:32 -07:00
|
|
|
} finally {
|
|
|
|
this.submitting = false;
|
|
|
|
}
|
2020-11-17 10:21:49 -08:00
|
|
|
},
|
|
|
|
edit(word) {
|
|
|
|
this.form = {
|
|
|
|
insteadOf: word.insteadOf,
|
|
|
|
say: word.say,
|
|
|
|
because: word.because,
|
2020-12-03 06:01:26 -08:00
|
|
|
categories: word.categories,
|
|
|
|
links: word.links,
|
2022-05-20 05:29:18 -07:00
|
|
|
clarification: word.clarification,
|
2020-11-17 10:21:49 -08:00
|
|
|
base: word.id,
|
|
|
|
}
|
2022-05-20 05:29:18 -07:00
|
|
|
this.clarification = !!word.clarification;
|
2020-12-03 06:01:26 -08:00
|
|
|
this.afterSubmit = false;
|
2020-11-17 10:21:49 -08:00
|
|
|
this.$el.scrollIntoView();
|
|
|
|
}
|
|
|
|
},
|
2022-05-20 05:29:18 -07:00
|
|
|
watch: {
|
|
|
|
clarification(v) {
|
|
|
|
if (v) {
|
2022-05-23 01:48:00 -07:00
|
|
|
if (!this.form.clarification) {
|
|
|
|
this.form.clarification = this.$t('inclusive.clarificationDefault');
|
|
|
|
}
|
2022-05-20 05:29:18 -07:00
|
|
|
} else {
|
|
|
|
this.form.clarification = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-11-17 10:21:49 -08:00
|
|
|
};
|
|
|
|
</script>
|