Skip to content

Commit

Permalink
Merge pull request #2530 from nextcloud/fix/2529-unlink-without-respo…
Browse files Browse the repository at this point in the history
…nses

Fix: Add disabled state to PillMenu and update Results view when there are no submissions
  • Loading branch information
Chartman123 authored Jan 29, 2025
2 parents ecbe5b5 + 391febd commit 862f39e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 46 deletions.
10 changes: 10 additions & 0 deletions src/components/PillMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:key="option.id"
:aria-label="isMobile ? option.ariaLabel : null"
:checked="active.id"
:disabled="disabled"
class="pill-menu__toggle"
:class="{ 'pill-menu__toggle--icon-only': isMobile && option.icon }"
button-variant
Expand Down Expand Up @@ -46,6 +47,15 @@ export default {
type: Object,
required: true,
},

/**
* If the PillMenu is disabled
*/
disabled: {
type: Boolean,
required: true,
},

/**
* List of available options
* `option: {id: string, title: string, ariaLabel: string, icon?: string}`
Expand Down
74 changes: 28 additions & 46 deletions src/views/Results.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,49 +34,6 @@
</template>
</NcEmptyContent>

<!-- No submissions -->
<NcEmptyContent
v-else-if="noSubmissions"
:name="t('forms', 'No responses yet')"
class="forms-emptycontent"
:description="
t('forms', 'Results of submitted forms will show up here')
">
<template #icon>
<IconPoll :size="64" />
</template>
<template #action>
<div class="response-actions">
<NcButton type="primary" @click="onShareForm">
<template #icon>
<IconShareVariant :size="20" decorative />
</template>
{{ t('forms', 'Share form') }}
</NcButton>

<NcButton
v-if="canEditForm && !form.fileId"
type="tertiary-no-background"
@click="onLinkFile">
<template #icon>
<IconLink :size="20" />
</template>
{{ t('forms', 'Create spreadsheet') }}
</NcButton>

<NcButton
v-if="form.fileId"
:href="fileUrl"
type="tertiary-no-background">
<template #icon>
<IconTable :size="20" />
</template>
{{ t('forms', 'Open spreadsheet') }}
</NcButton>
</div>
</template>
</NcEmptyContent>

<!-- Showing submissions -->
<template v-else>
<header>
Expand All @@ -94,6 +51,7 @@
<!-- View switcher between Summary and Responses -->
<div class="response-actions">
<PillMenu
:disabled="noSubmissions"
:options="responseViews"
:active.sync="activeResponseView"
class="response-actions__toggle" />
Expand Down Expand Up @@ -142,6 +100,7 @@
{{ t('forms', 'Create spreadsheet') }}
</NcActionButton>
<NcActionButton
v-if="!noSubmissions"
close-after-click
@click="onStoreToFiles">
<template #icon>
Expand All @@ -150,6 +109,7 @@
{{ t('forms', 'Save copy to Files') }}
</NcActionButton>
<NcActionButton
v-if="!noSubmissions"
:close-after-click="false"
:is-menu="true"
@click="isDownloadActionOpened = true">
Expand All @@ -158,9 +118,8 @@
</template>
{{ t('forms', 'Download') }}
</NcActionButton>

<NcActionButton
v-if="canDeleteSubmissions"
v-if="canDeleteSubmissions && !noSubmissions"
close-after-click
@click="deleteAllSubmissions">
<template #icon>
Expand Down Expand Up @@ -208,8 +167,31 @@
</div>
</header>

<!-- No submissions -->
<NcEmptyContent
v-if="noSubmissions"
:name="t('forms', 'No responses yet')"
class="forms-emptycontent"
:description="
t('forms', 'Results of submitted forms will show up here')
">
<template #icon>
<IconPoll :size="64" />
</template>
<template #action>
<div class="response-actions">
<NcButton type="primary" @click="onShareForm">
<template #icon>
<IconShareVariant :size="20" decorative />
</template>
{{ t('forms', 'Share form') }}
</NcButton>
</div>
</template>
</NcEmptyContent>

<!-- Summary view for visualization -->
<section v-if="activeResponseView.id === 'summary'">
<section v-else-if="activeResponseView.id === 'summary'">
<ResultsSummary
v-for="question in form.questions"
:key="question.id"
Expand Down

0 comments on commit 862f39e

Please sign in to comment.