refactor to use only one value for the blurImage status

This commit is contained in:
Alina Beck 2019-12-18 15:21:46 +05:30
parent edaac117eb
commit c74bfde652

View File

@ -10,7 +10,7 @@
<hc-teaser-image <hc-teaser-image
:contribution="contribution" :contribution="contribution"
@addTeaserImage="addTeaserImage" @addTeaserImage="addTeaserImage"
:class="{ '--blur-image': blurImage }" :class="{ '--blur-image': form.blurImage }"
@addImageAspectRatio="addImageAspectRatio" @addImageAspectRatio="addImageAspectRatio"
> >
<img <img
@ -23,7 +23,7 @@
<ds-card> <ds-card>
<div class="blur-toggle"> <div class="blur-toggle">
<label for="blur-img">{{ $t('contribution.inappropriatePicture') }}</label> <label for="blur-img">{{ $t('contribution.inappropriatePicture') }}</label>
<input name="checkbox" type="checkbox" id="blur-img" v-model="blurImage" /> <input type="checkbox" id="blur-img" v-model="form.blurImage" />
<p> <p>
<a <a
href="https://support.human-connection.org/kb/faq.php?id=113" href="https://support.human-connection.org/kb/faq.php?id=113"
@ -152,8 +152,9 @@ export default {
image: null, image: null,
language: null, language: null,
categoryIds: [], categoryIds: [],
checkbox: false, blurImage: false,
} }
let id = null let id = null
let slug = null let slug = null
const form = { ...formDefaults } const form = { ...formDefaults }
@ -168,7 +169,7 @@ export default {
? languageOptions.find(o => this.contribution.language === o.value) ? languageOptions.find(o => this.contribution.language === o.value)
: null : null
form.categoryIds = this.categoryIds(this.contribution.categories) form.categoryIds = this.categoryIds(this.contribution.categories)
form.checkbox = this.contribution.imageBlurred form.blurImage = this.contribution.imageBlurred
} }
return { return {
@ -188,7 +189,7 @@ export default {
}, },
}, },
language: { required: true }, language: { required: true },
checkbox: { required: false }, blurImage: { required: false },
}, },
languageOptions, languageOptions,
id, id,
@ -198,7 +199,6 @@ export default {
contentMin: 3, contentMin: 3,
hashtags: [], hashtags: [],
elem: null, elem: null,
blurImage: form.checkbox,
} }
}, },
computed: { computed: {
@ -219,6 +219,7 @@ export default {
teaserImage, teaserImage,
imageAspectRatio, imageAspectRatio,
categoryIds, categoryIds,
blurImage,
} = this.form } = this.form
this.loading = true this.loading = true
this.$apollo this.$apollo
@ -232,7 +233,7 @@ export default {
language, language,
image, image,
imageUpload: teaserImage, imageUpload: teaserImage,
imageBlurred: this.blurImage, imageBlurred: blurImage,
imageAspectRatio, imageAspectRatio,
}, },
}) })