Can use responses page to edit the survey (as this is default admin page for survey)
This commit is contained in:
parent
15bff5af96
commit
3bb6f0374c
@ -13,20 +13,26 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
|
import { user } from '../../../../stores/user';
|
||||||
import StartStopLiveSurvey from '../../../../components/StartStopLiveSurvey.svelte';
|
import StartStopLiveSurvey from '../../../../components/StartStopLiveSurvey.svelte';
|
||||||
|
import SurveyAdmin from '../../../../components/SurveyAdmin.svelte';
|
||||||
import SurveyBadge from '../../../../components/SurveyBadge.svelte';
|
import SurveyBadge from '../../../../components/SurveyBadge.svelte';
|
||||||
import SurveyQuestions from '../../../../components/SurveyQuestions.svelte';
|
import SurveyQuestions from '../../../../components/SurveyQuestions.svelte';
|
||||||
import { getQuestions } from '../../../../lib/questions';
|
import { getQuestions } from '../../../../lib/questions';
|
||||||
|
|
||||||
export let surveyP;
|
export let surveyP;
|
||||||
|
let edit = false;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#await surveyP then survey}
|
{#await surveyP then survey}
|
||||||
<StartStopLiveSurvey
|
{#if $user && $user.is_admin}
|
||||||
{survey}
|
<button class="btn btn-primary ms-1 float-end" on:click={() => { edit = !edit; } } title="Éditer"><i class="bi bi-pencil"></i></button>
|
||||||
class="ms-1 float-end"
|
<StartStopLiveSurvey
|
||||||
on:update={() => goto(`surveys/${survey.id}/admin`)}
|
{survey}
|
||||||
/>
|
class="ms-1 float-end"
|
||||||
|
on:update={() => goto(`surveys/${survey.id}/admin`)}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<h2>
|
<h2>
|
||||||
<a href="surveys/{survey.id}" class="text-muted" style="text-decoration: none"><</a>
|
<a href="surveys/{survey.id}" class="text-muted" style="text-decoration: none"><</a>
|
||||||
@ -36,6 +42,10 @@
|
|||||||
<SurveyBadge class="ms-2" {survey} />
|
<SurveyBadge class="ms-2" {survey} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{#if $user && $user.is_admin && edit}
|
||||||
|
<SurveyAdmin {survey} on:saved={() => edit = false} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#await getQuestions(survey.id)}
|
{#await getQuestions(survey.id)}
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div class="spinner-border text-primary mx-3" role="status"></div>
|
<div class="spinner-border text-primary mx-3" role="status"></div>
|
||||||
|
Reference in New Issue
Block a user