Skip to content
Snippets Groups Projects
Commit 40a85a84 authored by Konrad Mohrfeldt's avatar Konrad Mohrfeldt :koala:
Browse files

feat: add remaining permission checks for basic show settings

refs #247
parent 5a2b9fcb
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,7 @@
:errors="logoId.errors"
:is-saving="logoId.isSaving"
class="tw-mb-0"
edit-permissions="program.edit__show__logo"
custom-control
>
<div>
......@@ -95,6 +96,7 @@
:label="t('show.fields.imageId')"
:errors="imageId.errors"
:is-saving="imageId.isSaving"
edit-permissions="program.edit__show__image"
custom-control
>
<div>
......@@ -106,17 +108,23 @@
<AFieldset class="tw-bg-white" :title="t('show.section.content.title')">
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.categoryIds')"
custom-control
:is-saving="categories.isSaving"
:errors="categories.errors"
edit-permissions="program.edit__show__categories"
>
<ComboBoxSimple v-model="categories.value" :choices="categories.choices">
<ComboBoxSimple
v-model="categories.value"
:choices="categories.choices"
:disabled="disabled"
>
<template #selected="{ deselect }">
<Tag
v-for="category in categories.value"
:key="category.id"
removable
:removable="!disabled"
@remove="deselect(category)"
>
<span>
......@@ -131,30 +139,44 @@
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.topicIds')"
custom-control
:is-saving="topics.isSaving"
:errors="topics.errors"
edit-permissions="program.edit__show__topics"
>
<ComboBoxSimple v-model="topics.value" :choices="topics.choices" />
<ComboBoxSimple v-model="topics.value" :choices="topics.choices" :disabled="disabled" />
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.musicFocusIds')"
custom-control
:is-saving="musicFocuses.isSaving"
:errors="musicFocuses.errors"
edit-permissions="program.edit__show__music_focuses"
>
<ComboBoxSimple v-model="musicFocuses.value" :choices="musicFocuses.choices" />
<ComboBoxSimple
v-model="musicFocuses.value"
:choices="musicFocuses.choices"
:disabled="disabled"
/>
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.languageIds')"
custom-control
:is-saving="languages.isSaving"
:errors="languages.errors"
edit-permissions="program.edit__show__languages"
>
<ComboBoxSimple v-model="languages.value" :choices="languages.choices" />
<ComboBoxSimple
v-model="languages.value"
:choices="languages.choices"
:disabled="disabled"
/>
</FormGroup>
<FormGroup
......@@ -162,6 +184,7 @@
:label="t('show.fields.typeId')"
:errors="type.errors"
:is-saving="type.isSaving"
edit-permissions="program.edit__show__type"
>
<select v-model="type.valueId" v-bind="attrs">
<option
......@@ -181,43 +204,51 @@
:label="t('show.fields.email')"
:errors="email.errors"
:is-saving="email.isSaving"
edit-permissions="program.edit__show__email"
>
<input v-model="email.value" type="email" v-bind="attrs" @blur="email.save" />
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.links')"
:is-saving="links.isSaving"
:errors="links.errors.forField('links', '')"
:has-error="links.errors.length > 0"
custom-control
edit-permissions="program.edit__show__links"
>
<ALinkCollectionEditor
v-model="links.value"
:error-lists="links.errors.siblings('links')"
:disabled="disabled"
allow-add
@save="links.save()"
/>
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.hostIds')"
custom-control
:is-saving="hosts.isSaving"
:errors="hosts.errors"
edit-permissions="program.edit__show__hosts"
>
<ComboBoxSimple v-model="hosts.value" :choices="hosts.choices" />
<ComboBoxSimple v-model="hosts.value" :choices="hosts.choices" :disabled="disabled" />
</FormGroup>
<FormGroup
v-slot="{ disabled }"
:label="t('show.fields.ownerIds')"
class="tw-order-last"
:is-saving="owners.isSaving"
:errors="owners.errors"
edit-permissions="program.edit__show__owners"
>
<ComboBoxSimple
v-model="owners.value"
:disabled="!authStore.isSuperuser"
:disabled="disabled"
:search-provider="searchUsers"
>
<template #default="{ choice, ...itemAttrs }">
......@@ -227,7 +258,7 @@
</template>
<template #selected="{ deselect }">
<template v-for="user in owners.value" :key="user.id">
<UserPreview :user="user" removable @remove="deselect(user)" />
<UserPreview :user="user" :removable="!disabled" @remove="deselect(user)" />
</template>
</template>
</ComboBoxSimple>
......@@ -240,6 +271,7 @@
:label="t('show.fields.fundingCategoryId')"
:errors="fundingCategory.errors"
:is-saving="fundingCategory.isSaving"
edit-permissions="program.edit__show__funding_categories"
>
<select v-model="fundingCategory.valueId" v-bind="attrs">
<option
......@@ -257,6 +289,7 @@
:label="t('show.fields.cbaSeriesId')"
:errors="cbaSeriesId.errors"
:is-saving="cbaSeriesId.isSaving"
edit-permissions="program.edit__show__cba_series_id"
>
<input
v-model="cbaSeriesId.value"
......@@ -273,6 +306,7 @@
:label="t('show.fields.predecessorId')"
:errors="predecessor.errors"
:is-saving="predecessor.isSaving"
edit-permissions="program.edit__show__predecessor"
>
<select v-model="predecessor.valueId" v-bind="attrs">
<option
......@@ -285,31 +319,36 @@
</select>
</FormGroup>
<template v-if="authStore.isSuperuser">
<FormGroup
v-slot="attrs"
:label="t('show.fields.internalNote')"
:errors="internalNote.errors"
class="md:tw-col-span-2 tw-order-last"
:is-saving="internalNote.isSaving"
>
<textarea
ref="internalNoteEl"
v-model="internalNote.value"
class="tw-min-h-[100px]"
v-bind="attrs"
@blur="internalNote.save"
/>
</FormGroup>
</template>
<FormGroup
v-slot="attrs"
:label="t('show.fields.internalNote')"
:errors="internalNote.errors"
class="md:tw-col-span-2 tw-order-last"
:is-saving="internalNote.isSaving"
show-permissions="program.show__show__internal_note"
edit-permissions="program.edit__show__internal_note"
>
<textarea
ref="internalNoteEl"
v-model="internalNote.value"
class="tw-min-h-[100px]"
v-bind="attrs"
@blur="internalNote.save"
/>
</FormGroup>
</AFieldset>
<AFieldset :title="t('show.section.media.title')" class="tw-bg-white">
<FormGroup :errors="playlistId.errors">
<FormGroup
v-slot="{ disabled }"
:errors="playlistId.errors"
edit-permissions="program.edit__show__default_playlist"
>
<APlaylistEditor
:playlist="playlist"
:show="show"
:use-expert-mode="true"
:disabled="disabled"
class="tw-max-w-3xl"
@create="playlistId.value = $event.id"
/>
......@@ -342,7 +381,6 @@ import { useI18n } from '@/i18n'
import { Show } from '@/types'
import { useAPIObjectFieldCopy, useRelation, useRelationList } from '@/form'
import {
useAuthStore,
useCategoryStore,
useFundingCategoryStore,
useHostStore,
......@@ -378,7 +416,6 @@ const props = defineProps<{
}>()
const { t } = useI18n()
const authStore = useAuthStore()
const userStore = useUserStore()
const showStore = useShowStore()
const typeStore = useTypeStore()
......
<template>
<FormGroup :errors="isActive.errors">
<FormGroup
v-slot="{ disabled }"
:errors="isActive.errors"
edit-permissions="program.edit__show__is_active"
>
<div>
<template v-if="isActive.value">
<button
type="button"
class="btn btn-default tw-w-full tw-justify-center"
:disabled="disabled"
@click="confirmShowDeactivation"
>
<Loading v-if="isActive.isSaving" class="tw-h-2" />
......
<template>
<FormGroup :errors="errors">
<FormGroup v-slot="{ disabled }" :errors="errors" edit-permissions="program.delete_show">
<div>
<button
type="button"
class="btn btn-default tw-w-full tw-justify-center"
:disabled="disabled"
@click="confirmDeleteShow"
>
<Loading v-if="isProcessing" class="tw-h-2" />
......
<template>
<FormGroup v-slot="attrs" :errors="slug.errors">
<FormGroup v-slot="attrs" :errors="slug.errors" edit-permissions="program.edit__show__slug">
<div>
<div class="tw-flex tw-gap-2 tw-flex-wrap">
<input v-model="newSlug" type="text" v-bind="attrs" class="tw-min-w-48 tw-flex-[2]" />
<button
type="button"
class="btn btn-default tw-whitespace-nowrap tw-flex-none"
:disabled="newSlug === show.slug"
:disabled="attrs.disabled || newSlug === show.slug"
@click="confirmSlugRenaming"
>
<Loading v-if="slug.isSaving" class="tw-h-2" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment