Rename event deletePost to removePostFromList

Co-Authored-By: mattwr18 <mattwr18@gmail.com>
This commit is contained in:
Wolfgang Huß 2019-06-12 15:58:23 +02:00
parent 1c6016ddcc
commit 8eb089d218
7 changed files with 52 additions and 54 deletions

View File

@ -164,7 +164,7 @@ describe('DeleteModal.vue', () => {
expect(propsData.callbacks.confirm).toHaveBeenCalledTimes(1)
})
it('emits close', () => {
expect(wrapper.emitted().close).toBeTruthy()
expect(wrapper.emitted().close).toHaveLength(1)
})
it('resets success', () => {

View File

@ -103,8 +103,8 @@ export default {
return this.user.id === this.post.author.id
},
menuModalsData() {
// "this.post" may not always be defined at the beginning
return PostHelpers.postMenuModalsData(
// "this.post" may not always be defined at the beginning
this.post ? this.$filters.truncate(this.post.title, 30) : '',
this.deletePostCallback,
)
@ -115,7 +115,7 @@ export default {
try {
await this.$apollo.mutate(PostHelpers.deletePostMutationData(this.post.id))
this.$toast.success(this.$t('delete.contribution.success'))
this.$emit('deletePost')
this.$emit('removePostFromList')
} catch (err) {
this.$toast.error(err.message)
}

View File

@ -1,7 +1,7 @@
import gql from 'graphql-tag'
export default {
postMenuModalsData: (postNameShort, confirmCallback) => {
postMenuModalsData(postNameShort, confirmCallback) {
return {
delete: {
titleIdent: 'delete.contribution.title',

View File

@ -9,7 +9,7 @@
:key="post.id"
:post="post"
:width="{ base: '100%', xs: '100%', md: '50%', xl: '33%' }"
@deletePost="deletePost(index, post.id)"
@removePostFromList="deletePost(index, post.id)"
/>
</ds-flex>
<no-ssr>

View File

@ -210,9 +210,9 @@ export default {
}, 50)
},
computed: {
// "this.post" may not always be defined at the beginning
menuModalsData() {
return PostHelpers.postMenuModalsData(
// "this.post" may not always be defined at the beginning
this.post ? this.$filters.truncate(this.post.title, 30) : '',
this.deletePostCallback,
)

View File

@ -1,13 +1,10 @@
<template>
<ds-card>
<h2 style="margin-bottom: .2em;">
Mehr Informationen
</h2>
<h2 style="margin-bottom: .2em;">Mehr Informationen</h2>
<p>Hier findest du weitere infos zum Thema.</p>
<ds-space/>
<h3>
<ds-icon name="compass" />
Themenkategorien
<ds-icon name="compass"/>Themenkategorien
</h3>
<div class="tags">
<ds-icon
@ -16,16 +13,14 @@
v-tooltip="{ content: category.name, placement: 'top-start', delay: { show: 300 } }"
:name="category.icon"
size="large"
/>
&nbsp;
/>&nbsp;
<!--<ds-tag
v-for="category in post.categories"
:key="category.id"><ds-icon :name="category.icon" /> {{ category.name }}</ds-tag>-->
</div>
<template v-if="post.tags && post.tags.length">
<h3>
<ds-icon name="tags" />
Schlagwörter
<ds-icon name="tags"/>Schlagwörter
</h3>
<div class="tags">
<ds-tag v-for="tag in post.tags" :key="tag.id">
@ -42,7 +37,7 @@
:key="relatedPost.id"
:post="relatedPost"
:width="{ base: '100%', lg: 1 }"
@deletePost="post.relatedContributions.splice(index, 1)"
@removePostFromList="post.relatedContributions.splice(index, 1)"
/>
</ds-flex>
<hc-empty v-else margin="large" icon="file" message="No related Posts"/>

View File

@ -28,9 +28,11 @@
<ds-icon name="map-marker"/>
{{ user.location.name }}
</ds-text>
<ds-text align="center" color="soft" size="small">
{{ $t('profile.memberSince') }} {{ user.createdAt | date('MMMM yyyy') }}
</ds-text>
<ds-text
align="center"
color="soft"
size="small"
>{{ $t('profile.memberSince') }} {{ user.createdAt | date('MMMM yyyy') }}</ds-text>
</ds-space>
<ds-space v-if="user.badges && user.badges.length" margin="x-small">
<hc-badges :badges="user.badges"/>
@ -61,16 +63,14 @@
/>
</ds-space>
<template v-if="user.about">
<hr />
<hr>
<ds-space margin-top="small" margin-bottom="small">
<ds-text color="soft" size="small">{{ user.about }}</ds-text>
</ds-space>
</template>
</ds-card>
<ds-space/>
<ds-heading tag="h3" soft style="text-align: center; margin-bottom: 10px;">
Netzwerk
</ds-heading>
<ds-heading tag="h3" soft style="text-align: center; margin-bottom: 10px;">Netzwerk</ds-heading>
<ds-card style="position: relative; height: auto;">
<ds-space v-if="user.following && user.following.length" margin="x-small">
<ds-text tag="h5" color="soft">Wem folgt {{ userName | truncate(15) }}?</ds-text>
@ -83,9 +83,10 @@
</no-ssr>
</ds-space>
<ds-space v-if="user.followingCount - user.following.length" margin="small">
<ds-text size="small" color="softer">
und {{ user.followingCount - user.following.length }} weitere
</ds-text>
<ds-text
size="small"
color="softer"
>und {{ user.followingCount - user.following.length }} weitere</ds-text>
</ds-space>
</template>
<template v-else>
@ -105,9 +106,10 @@
</no-ssr>
</ds-space>
<ds-space v-if="user.followedByCount - user.followedBy.length" margin="small">
<ds-text size="small" color="softer">
und {{ user.followedByCount - user.followedBy.length }} weitere
</ds-text>
<ds-text
size="small"
color="softer"
>und {{ user.followedByCount - user.followedBy.length }} weitere</ds-text>
</ds-space>
</template>
<template v-else>
@ -117,9 +119,10 @@
<ds-space v-if="user.socialMedia && user.socialMedia.length" margin="large">
<ds-card style="position: relative; height: auto;">
<ds-space margin="x-small">
<ds-text tag="h5" color="soft">
{{ $t('profile.socialMedia') }} {{ user.name | truncate(15) }}?
</ds-text>
<ds-text
tag="h5"
color="soft"
>{{ $t('profile.socialMedia') }} {{ user.name | truncate(15) }}?</ds-text>
<template>
<ds-space v-for="link in socialMediaLinks" :key="link.username" margin="x-small">
<a :href="link.url">
@ -212,7 +215,7 @@
:key="post.id"
:post="post"
:width="{ base: '100%', md: '100%', xl: '50%' }"
@deletePost="user.contributions.splice(index, 1)"
@removePostFromList="user.contributions.splice(index, 1)"
/>
</template>
<template v-else>