fix reviews ContributionForm, ContributionForm.spec

This commit is contained in:
ogerly 2019-12-06 10:53:26 +01:00
parent a62d59741b
commit 652f6d1edc
3 changed files with 15 additions and 34 deletions

View File

@ -243,15 +243,7 @@ describe('ContributionForm.vue', () => {
expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1) expect(mocks.$apollo.mutate).toHaveBeenCalledTimes(1)
}) })
describe('questionable images should be blurred', () => {
it('questionable images unset be blurred', async () => {
expectedParams.variables.imageUpload = imageUpload
wrapper.find(TeaserImage).vm.$emit('addTeaserImage', imageUpload)
expect(wrapper.find('.images-set-blur').exists()).toBe(false)
await wrapper.find('input[type="checkbox"]').trigger('click')
expect(wrapper.find('.images-set-blur').exists()).toBe(true)
})
})
it("pushes the user to the post's page", async () => { it("pushes the user to the post's page", async () => {
wrapper.find('form').trigger('submit') wrapper.find('form').trigger('submit')

View File

@ -19,11 +19,11 @@
:src="contribution.image | proxyApiUrl" :src="contribution.image | proxyApiUrl"
/> />
</hc-teaser-image> </hc-teaser-image>
<ds-text align="right" class="blurBox"> <ds-text align="right" class="blur-box">
<div v-show="blurImage"> <div v-show="blurImage">
<img <img
:src="contribution.image | proxyApiUrl" :src="contribution.image | proxyApiUrl"
class="blurImgPreview" class="blur-img-preview"
@click.prevent="unBlur" @click.prevent="unBlur"
/> />
<ds-button class="bluricon-post" icon="ban" primary @click.prevent="unBlur"></ds-button> <ds-button class="bluricon-post" icon="ban" primary @click.prevent="unBlur"></ds-button>
@ -32,17 +32,17 @@
<div style="clear: both" /> <div style="clear: both" />
<ds-card> <ds-card>
<ds-text align="right"> <ds-text align="right">
<label for="blur_img">{{ $t('contribution.shockingPicture') }}</label> <label for="blur-img">{{ $t('contribution.shockingPicture') }}</label>
<input <input
name="checkbox" name="checkbox"
class="blurImageCheckbox" class="blurImageCheckbox"
type="checkbox" type="checkbox"
id="blur_img" id="blur-img"
v-model="blurImage" v-model="blurImage"
@change="form.checkbox = blurImage" @change="form.checkbox = blurImage"
/> />
<label for="blur_img"><span class=""></span></label> <label for="blur-img"><span class=""></span></label>
<div> <div>
<a href="https://faq.human-connection.org/" target="_blank"> <a href="https://faq.human-connection.org/" target="_blank">
<small> <small>
@ -340,13 +340,13 @@ export default {
-o-transition: all ease 0.2s; -o-transition: all ease 0.2s;
transition: all ease 0.2s; transition: all ease 0.2s;
} }
.blurBox { .blur-box {
text-align: right; text-align: right;
position: relative; position: relative;
top: -70px; top: -70px;
float: right; float: right;
} }
.blurImgPreview { .blur-img-preview {
width: 100px; width: 100px;
} }

View File

@ -7,14 +7,14 @@
:class="{ :class="{
'post-card': true, 'post-card': true,
'disabled-content': post.disabled, 'disabled-content': post.disabled,
'images-set-blur': post.blurImage, 'images-set-blur': blurred,
}" }"
> >
<ds-text v-show="post.blurImage" align="right" class="blurBox"> <ds-text v-show="post.blurImage" align="right" class="blurBox">
<img <img
v-show="!blurred" v-show="blurred"
:src="post.image | proxyApiUrl" :src="post.image | proxyApiUrl"
class="blurImgPreview" class="blur-img-preview"
@click.prevent="unBlur" @click.prevent="unBlur"
/> />
<ds-button <ds-button
@ -22,14 +22,14 @@
class="bluricon-post" class="bluricon-post"
icon="eye-slash" icon="eye-slash"
primary primary
@click.prevent="setBlur" @click.prevent="blurred = false"
></ds-button> ></ds-button>
<ds-button <ds-button
v-else v-else
class="bluricon-post" class="bluricon-post"
icon="eye" icon="eye"
primary primary
@click.prevent="unBlur" @click.prevent="blurred = true"
></ds-button> ></ds-button>
</ds-text> </ds-text>
<div style="clear: both" /> <div style="clear: both" />
@ -158,6 +158,7 @@ export default {
Post(post) { Post(post) {
this.post = post[0] || {} this.post = post[0] || {}
this.title = this.post.title this.title = this.post.title
this.blurred = this.post.blurImage
}, },
}, },
mounted() { mounted() {
@ -177,18 +178,6 @@ export default {
}, },
}, },
methods: { methods: {
unBlur() {
if (this.post.blurImage) {
this.post.blurImage = false
this.blurred = true
}
},
setBlur() {
if (!this.post.blurImage) {
this.post.blurImage = true
this.blurred = false
}
},
isAuthor(id) { isAuthor(id) {
return this.$store.getters['auth/user'].id === id return this.$store.getters['auth/user'].id === id
}, },
@ -265,7 +254,7 @@ export default {
top: -70px; top: -70px;
float: right; float: right;
} }
.blurImgPreview { .blur-img-preview {
width: 100px; width: 100px;
} }