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

feat: hide danger zone form elements if the user is not allowed to use them

refs #290
parent 116cb26f
No related branches found
No related tags found
No related merge requests found
...@@ -5,18 +5,24 @@ ...@@ -5,18 +5,24 @@
> >
<AFieldset class="tw-bg-white" :title="t('show.housekeeping.title')"> <AFieldset class="tw-bg-white" :title="t('show.housekeeping.title')">
<div class="tw-flex tw-gap-6 tw-flex-wrap"> <div class="tw-flex tw-gap-6 tw-flex-wrap">
<AHousekeepingSection :title="t('show.housekeeping.flows.archival')"> <APermissionGuard show-permissions="program.edit__show__is_active">
<AShowArchivalFlow :show="show" /> <AHousekeepingSection :title="t('show.housekeeping.flows.archival')">
</AHousekeepingSection> <AShowArchivalFlow :show="show" />
<AHousekeepingSection :title="t('show.housekeeping.flows.deletion')"> </AHousekeepingSection>
<AShowDeletionFlow :show="show" /> </APermissionGuard>
</AHousekeepingSection> <APermissionGuard show-permissions="program.delete_show">
<AHousekeepingSection <AHousekeepingSection :title="t('show.housekeeping.flows.deletion')">
:title="t('show.housekeeping.flows.slugRenaming')" <AShowDeletionFlow :show="show" />
class="tw-flex-[2] tw-max-w-xl" </AHousekeepingSection>
> </APermissionGuard>
<AShowSlugRenamingFlow :show="show" /> <APermissionGuard show-permissions="program.edit__show__slug">
</AHousekeepingSection> <AHousekeepingSection
:title="t('show.housekeeping.flows.slugRenaming')"
class="tw-flex-[2] tw-max-w-xl"
>
<AShowSlugRenamingFlow :show="show" />
</AHousekeepingSection>
</APermissionGuard>
</div> </div>
</AFieldset> </AFieldset>
</div> </div>
...@@ -30,6 +36,7 @@ import AShowDeletionFlow from '@/components/shows/AShowDeletionFlow.vue' ...@@ -30,6 +36,7 @@ import AShowDeletionFlow from '@/components/shows/AShowDeletionFlow.vue'
import AShowSlugRenamingFlow from '@/components/shows/AShowSlugRenamingFlow.vue' import AShowSlugRenamingFlow from '@/components/shows/AShowSlugRenamingFlow.vue'
import AHousekeepingSection from '@/components/shows/AHousekeepingSection.vue' import AHousekeepingSection from '@/components/shows/AHousekeepingSection.vue'
import AFieldset from '@/components/generic/AFieldset.vue' import AFieldset from '@/components/generic/AFieldset.vue'
import APermissionGuard from '@/components/generic/APermissionGuard.vue'
defineProps<{ defineProps<{
show: Show show: Show
......
<template> <template>
<FormGroup <FormGroup :errors="isActive.errors">
v-slot="{ disabled }"
:errors="isActive.errors"
edit-permissions="program.edit__show__is_active"
>
<div> <div>
<template v-if="isActive.value"> <template v-if="isActive.value">
<button <button
type="button" type="button"
class="btn btn-default tw-w-full tw-justify-center" class="btn btn-default tw-w-full tw-justify-center"
:disabled="disabled"
@click="confirmShowDeactivation" @click="confirmShowDeactivation"
> >
<Loading v-if="isActive.isSaving" class="tw-h-2" /> <Loading v-if="isActive.isSaving" class="tw-h-2" />
......
<template> <template>
<FormGroup v-slot="{ disabled }" :errors="errors" edit-permissions="program.delete_show"> <FormGroup :errors="errors">
<div> <div>
<button <button
type="button" type="button"
class="btn btn-default tw-w-full tw-justify-center" class="btn btn-default tw-w-full tw-justify-center"
:disabled="disabled"
@click="confirmDeleteShow" @click="confirmDeleteShow"
> >
<Loading v-if="isProcessing" class="tw-h-2" /> <Loading v-if="isProcessing" class="tw-h-2" />
......
<template> <template>
<FormGroup v-slot="attrs" :errors="slug.errors" edit-permissions="program.edit__show__slug"> <FormGroup v-slot="attrs" :errors="slug.errors">
<div> <div>
<div class="tw-flex tw-gap-2 tw-flex-wrap"> <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]" /> <input v-model="newSlug" type="text" v-bind="attrs" class="tw-min-w-48 tw-flex-[2]" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment