Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Don't show links to manage stuff when not editor (#2700)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksellen committed Jan 9, 2024
1 parent fc4c7b9 commit 47cff45
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 42 deletions.
1 change: 1 addition & 0 deletions src/locales/locale-en.json
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@
"DESCRIPTION": "Description",
"NAME": "Name",
"MANAGE_TYPES": "Manage types",
"MANAGE_STATUSES": "Manage statuses",
"STATUS": "Status",
"VISIBLE": "Visible"
},
Expand Down
96 changes: 54 additions & 42 deletions src/places/pages/Places.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,29 @@
dense
>
<template #option="{ index, opt, itemProps }">
<template v-if="opt.value === '$manage'">
<QSeparator />
<QItem
:key="index"
clickable
:to="{ name: 'groupEditPlaceTypes' }"
>
<QItemSection side>
<QIcon
name="fa fa-cog"
color="gray"
size="1.1em"
/>
</QItemSection>
<QItemSection>
<QItemLabel class="text-italic">
{{ $t('LABELS.MANAGE_TYPES') }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
<QItem
v-else
:key="index"
dense
v-bind="itemProps"
Expand Down Expand Up @@ -48,26 +70,6 @@
</QItem>
<QSeparator v-if="!opt.value" />
</template>
<template #after-options>
<QSeparator />
<QItem
clickable
:to="{ name: 'groupEditPlaceTypes' }"
>
<QItemSection side>
<QIcon
name="fa fa-cog"
color="gray"
size="1.1em"
/>
</QItemSection>
<QItemSection>
<QItemLabel class="text-italic">
Manage types
</QItemLabel>
</QItemSection>
</QItem>
</template>
</QSelect>
<QSelect
v-model="status"
Expand All @@ -80,6 +82,26 @@
>
<template #option="{ index, opt, itemProps }">
<QSeparator v-if="opt.value === '$seperator'" />
<template v-else-if="opt.value === '$manage'">
<QSeparator />
<QItem
clickable
:to="{ name: 'groupEditPlaceStatuses' }"
>
<QItemSection side>
<QIcon
name="fa fa-cog"
color="gray"
size="1.1em"
/>
</QItemSection>
<QItemSection>
<QItemLabel class="text-italic">
{{ $t('LABELS.MANAGE_STATUSES') }}
</QItemLabel>
</QItemSection>
</QItem>
</template>
<QItem
v-else
:key="index"
Expand Down Expand Up @@ -127,26 +149,6 @@
</div>
</div>
</template>
<template #after-options>
<QSeparator />
<QItem
clickable
:to="{ name: 'groupEditPlaceStatuses' }"
>
<QItemSection side>
<QIcon
name="fa fa-cog"
color="gray"
size="1.1em"
/>
</QItemSection>
<QItemSection>
<QItemLabel class="text-italic">
Manage statuses
</QItemLabel>
</QItemSection>
</QItem>
</template>
</QSelect>
<QInput
:model-value="search"
Expand Down Expand Up @@ -408,7 +410,7 @@ function getUnreadWallMessageCount (place) {
return getPlaceStatus(place.id)?.unreadWallMessageCount
}
const typeOptions = computed(() => ([
const typeOptions = computed(() => [
{
label: t('PLACE_LIST.ALL_TYPES'),
value: null,
Expand All @@ -422,7 +424,10 @@ const typeOptions = computed(() => ([
placeType,
}
}),
]))
isEditor.value && {
value: '$manage',
},
].filter(Boolean))
const { getPlaceStatusesByGroup } = usePlaceStatusService()
Expand Down Expand Up @@ -472,6 +477,13 @@ const statusOptions = computed(() => {
})
}
})
if (isEditor.value) {
options.push({
value: '$manage',
})
}
return options
})
Expand Down

0 comments on commit 47cff45

Please sign in to comment.