mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-06-04 14:15:24 -04:00
* add groupSlug to most routes * fixed more routing issues * fixed jank and incorrect routes * remove public explore links * remove unused groupSlug and explore routes * nuked explore pages * fixed public toolstore bug * fixed various routes missing group slug * restored public app header menu * fix janky login redirect * 404 recipe API call returns to login * removed unused explore layout * force redirect when using the wrong group slug * fixed dead admin links * removed unused middleware from earlier attempt * 🧹 * improve cookbooks sidebar fixed sidebar link not working fixed sidebar link target hide cookbooks header when there are none * added group slug to user * fix $auth typehints * vastly simplified groupSlug logic * allow logged-in users to view other groups * fixed some edgecases that bypassed isOwnGroup * fixed static home ref * 🧹 * fixed redirect logic * lint warning * removed group slug from group and user pages refactored all components to use route groupSlug or user group slug moved some group pages to recipe pages * fixed some bad types * 🧹 * moved groupSlug routes under /g/groupSlug * move /recipe/ to /r/ * fix backend url generation and metadata injection * moved shopping lists to root/other route fixes * changed shared from /recipes/ to /r/ * fixed 404 redirect not awaiting * removed unused import * fix doc links * fix public recipe setting not affecting public API * fixed backend tests * fix nuxt-generate command --------- Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
129 lines
3.9 KiB
Vue
129 lines
3.9 KiB
Vue
<template>
|
|
<v-container>
|
|
<BasePageTitle divider>
|
|
<template #header>
|
|
<v-img max-height="125" max-width="125" :src="require('~/static/svgs/manage-members.svg')"></v-img>
|
|
</template>
|
|
<template #title> {{ $t('group.manage-members') }} </template>
|
|
<i18n path="group.manage-members-description">
|
|
<template #manage>
|
|
<b>{{ $t('group.manage') }}</b>
|
|
</template>
|
|
<template #invite>
|
|
<b>{{ $t('group.invite') }}</b>
|
|
</template>
|
|
</i18n>
|
|
<v-container class="mt-1 px-0">
|
|
<nuxt-link class="text-center" :to="`/user/profile/edit`"> {{ $t('group.looking-to-update-your-profile') }} </nuxt-link>
|
|
</v-container>
|
|
</BasePageTitle>
|
|
<v-data-table
|
|
:headers="headers"
|
|
:items="members || []"
|
|
item-key="id"
|
|
class="elevation-0"
|
|
hide-default-footer
|
|
disable-pagination
|
|
>
|
|
<template #item.avatar="{ item }">
|
|
<UserAvatar :user-id="item.id" />
|
|
</template>
|
|
<template #item.admin="{ item }">
|
|
{{ item.admin ? $t('user.admin') : $t('user.user') }}
|
|
</template>
|
|
<template #item.manage="{ item }">
|
|
<div class="d-flex justify-center">
|
|
<v-checkbox
|
|
v-model="item.canManage"
|
|
:disabled="item.id === $auth.user.id || item.admin"
|
|
class=""
|
|
style="max-width: 30px"
|
|
@change="setPermissions(item)"
|
|
></v-checkbox>
|
|
</div>
|
|
</template>
|
|
<template #item.organize="{ item }">
|
|
<div class="d-flex justify-center">
|
|
<v-checkbox
|
|
v-model="item.canOrganize"
|
|
:disabled="item.id === $auth.user.id || item.admin"
|
|
class=""
|
|
style="max-width: 30px"
|
|
@change="setPermissions(item)"
|
|
></v-checkbox>
|
|
</div>
|
|
</template>
|
|
<template #item.invite="{ item }">
|
|
<div class="d-flex justify-center">
|
|
<v-checkbox
|
|
v-model="item.canInvite"
|
|
:disabled="item.id === $auth.user.id || item.admin"
|
|
class=""
|
|
style="max-width: 30px"
|
|
@change="setPermissions(item)"
|
|
></v-checkbox>
|
|
</div>
|
|
</template>
|
|
</v-data-table>
|
|
</v-container>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { defineComponent, ref, onMounted, useContext } from "@nuxtjs/composition-api";
|
|
import { useUserApi } from "~/composables/api";
|
|
import { UserOut } from "~/lib/api/types/user";
|
|
import UserAvatar from "~/components/Domain/User/UserAvatar.vue";
|
|
|
|
export default defineComponent({
|
|
components: {
|
|
UserAvatar,
|
|
},
|
|
setup() {
|
|
const api = useUserApi();
|
|
|
|
const { i18n } = useContext();
|
|
|
|
const members = ref<UserOut[] | null[]>([]);
|
|
|
|
const headers = [
|
|
{ text: "", value: "avatar", sortable: false, align: "center" },
|
|
{ text: i18n.t("user.username"), value: "username" },
|
|
{ text: i18n.t("user.full-name"), value: "fullName" },
|
|
{ text: i18n.t("user.admin"), value: "admin" },
|
|
{ text: i18n.t("group.manage"), value: "manage", sortable: false, align: "center" },
|
|
{ text: i18n.t("settings.organize"), value: "organize", sortable: false, align: "center" },
|
|
{ text: i18n.t("group.invite"), value: "invite", sortable: false, align: "center" },
|
|
];
|
|
|
|
async function refreshMembers() {
|
|
const { data } = await api.groups.fetchMembers();
|
|
if (data) {
|
|
members.value = data;
|
|
}
|
|
}
|
|
|
|
async function setPermissions(user: UserOut) {
|
|
const payload = {
|
|
userId: user.id,
|
|
canInvite: user.canInvite,
|
|
canManage: user.canManage,
|
|
canOrganize: user.canOrganize,
|
|
};
|
|
|
|
await api.groups.setMemberPermissions(payload);
|
|
}
|
|
|
|
onMounted(async () => {
|
|
await refreshMembers();
|
|
});
|
|
|
|
return { members, headers, setPermissions };
|
|
},
|
|
head() {
|
|
return {
|
|
title: this.$t("profile.members"),
|
|
};
|
|
},
|
|
});
|
|
</script>
|