Skip to content

Commit

Permalink
Merge pull request #59 from beabee-communityrm/feat/1182-prefilled-an…
Browse files Browse the repository at this point in the history
…swers

feat: support simple prefilled answer query parameter
  • Loading branch information
wpf500 authored Oct 21, 2024
2 parents 576058a + e0bd5a0 commit 4ebcf8c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
:locales="steps.settings.data.locales"
/>
</div>
<div class="text-right">
<div class="flex justify-between">
<div>
<p v-if="showAdvancedOptions" class="text-sm text-grey">
{{ t('common.id') }}: {{ currentSlide.id }}
</p>
</div>
<AppButton
variant="dangerOutlined"
:icon="faTrash"
Expand Down
11 changes: 10 additions & 1 deletion apps/frontend/src/pages/callouts/[id]/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ meta:

<CalloutForm
:callout="callout"
:answers="latestResponse?.answers"
:answers="prefilledAnswers"
:preview="isPreview"
:readonly="!canRespond"
:all-slides="!canRespond"
Expand All @@ -83,6 +83,7 @@ meta:
<script lang="ts" setup>
import {
ItemStatus,
type CalloutResponseAnswersSlide,
type GetCalloutDataWith,
type GetCalloutResponseDataWith,
type Paginated,
Expand Down Expand Up @@ -170,6 +171,14 @@ const latestResponse = computed(() =>
props.callout.allowMultiple ? undefined : responses.value?.items?.[0]
);
const prefilledAnswers = computed(() =>
route.query.answers
? (JSON.parse(
route.query.answers.toString()
) as CalloutResponseAnswersSlide)
: latestResponse.value?.answers
);
const canRespond = computed(
() =>
// Preview mode
Expand Down

0 comments on commit 4ebcf8c

Please sign in to comment.