-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refine design and functionality of group list and create, edit group
- Loading branch information
Showing
11 changed files
with
292 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,121 +1,21 @@ | ||
<template> | ||
<div> | ||
<!-- Wolle: <ds-container class="group-card"> --> | ||
<!-- Wolle: <ds-space> | ||
<div @click="onlyOwnerGroups(true)" ref="myGruops"> | ||
<ds-button>{{ $t('group.showMyCreatedGroups') }}</ds-button> | ||
</div> | ||
<div @click="onlyOwnerGroups(false)" ref="allGruops" hidden> | ||
<ds-button>{{ $t('group.showAllMyGroups') }}</ds-button> | ||
</div> | ||
</ds-space> --> | ||
<ds-space margin-bottom="small" v-for="item in items" :key="item.id"> | ||
<!-- Wolle: <ds-card :ref="item.myRole === null ? 'null' : item.myRole"> --> | ||
<ds-card> | ||
<ds-flex> | ||
<ds-flex-item width="90%" centered> | ||
<ds-space margin="large"> | ||
<nuxt-link :to="`/group/${item.id}`"> | ||
<ds-text size="x-large">{{ item.name }}</ds-text> | ||
</nuxt-link> | ||
<ds-text size="small"> | ||
{{ item.groupType }} | ||
<ds-chip v-if="item.myRole === 'owner'" color="inverse">{{ item.myRole }}</ds-chip> | ||
<ds-chip v-if="item.myRole === 'usual' || item.myRole === 'pending'"> | ||
{{ item.myRole }} | ||
</ds-chip> | ||
</ds-text> | ||
<ds-space v-if="item.about" margin-top="small"> | ||
<ds-text bold>{{ item.about }}</ds-text> | ||
</ds-space> | ||
<ds-space margin-top="small"> | ||
<div v-html="item.descriptionExcerpt"></div> | ||
</ds-space> | ||
<ds-space margin-top="small"> | ||
<ds-chip v-for="category in item.categories" :key="category.name"> | ||
<ds-icon :name="category.icon"></ds-icon> | ||
{{ category.name }} | ||
</ds-chip> | ||
<ds-space margin="x-small"> | ||
<div v-if="item.locationName">{{ item.locationName }}</div> | ||
<div v-if="item.actionRadius">{{ item.actionRadius }}</div> | ||
</ds-space> | ||
</ds-space> | ||
</ds-space> | ||
</ds-flex-item> | ||
<ds-flex-item width="10%" centered> | ||
<group-menu | ||
v-if="item.myRole === 'owner'" | ||
resource-type="group" | ||
:resource="item" | ||
:isOwner="item.myRole" | ||
@joinGroup="joinGroup" | ||
/> | ||
</ds-flex-item> | ||
</ds-flex> | ||
</ds-card> | ||
<ds-space margin-bottom="small" v-for="group in groups" :key="group.id"> | ||
<group-teaser :group="group" /> | ||
</ds-space> | ||
<!-- Wolle: </ds-container> --> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import GroupMenu from '~/components/Group/GroupMenu' | ||
import { joinGroupMutation } from '~/graphql/groups.js' | ||
import GroupTeaser from '~/components/Group/GroupTeaser' | ||
export default { | ||
name: 'GroupList', | ||
components: { | ||
GroupMenu, | ||
GroupTeaser, | ||
}, | ||
props: { | ||
items: { type: Array, default: () => [] }, | ||
}, | ||
methods: { | ||
editGroup(item) { | ||
this.$router.push({ path: `/group/edit/${item.id}` }) | ||
}, | ||
async joinGroup(value) { | ||
const { id } = value | ||
const variables = { groupId: id, userId: this.$store.getters['auth/user'].id } | ||
try { | ||
await this.$apollo.mutate({ | ||
mutation: joinGroupMutation(), | ||
variables, | ||
}) | ||
this.$toast.success(this.$t('group.groupCreated')) | ||
} catch (error) { | ||
this.$toast.error(error.message) | ||
} | ||
}, | ||
// Wolle: onlyOwnerGroups(bool) { | ||
// this.$refs.myGruops.hidden = bool | ||
// this.$refs.allGruops.hidden = !bool | ||
// if (this.$refs.usual) { | ||
// this.$refs.usual.forEach((element) => { | ||
// element.$el.hidden = bool | ||
// }) | ||
// } | ||
// if (this.$refs.null) { | ||
// this.$refs.null.forEach((element) => { | ||
// element.$el.hidden = bool | ||
// }) | ||
// } | ||
// if (this.$refs.pending) { | ||
// this.$refs.pending.forEach((element) => { | ||
// element.$el.hidden = bool | ||
// }) | ||
// } | ||
// }, | ||
groups: { type: Array, default: () => [] }, | ||
}, | ||
} | ||
</script> | ||
<style scoped> | ||
.border-bottom { | ||
border-bottom: 1px solid #17b53f; | ||
background-color: rgb(255, 255, 255); | ||
padding-left: 20px; | ||
} | ||
</style> |
Oops, something went wrong.