Quizzes can now be exported as excel files

This commit is contained in:
Mawoka
2023-10-30 11:11:50 +01:00
parent 8691d6cde0
commit 31d1e3e3e6
5 changed files with 135 additions and 8 deletions
+4 -1
View File
@@ -5,6 +5,7 @@ SPDX-License-Identifier: MPL-2.0
-->
<script lang="ts">
import DownloadQuiz from '$lib/components/DownloadQuiz.svelte';
import type { QuizData } from '$lib/quiz_types';
import { getLocalization } from '$lib/i18n';
import Footer from '$lib/footer.svelte';
@@ -25,6 +26,7 @@ SPDX-License-Identifier: MPL-2.0
export let data: PageData;
let search_term = '';
let start_game = null;
let download_id: string | null = null;
signedIn.set(true);
navbarVisible.set(true);
const { t } = getLocalization();
@@ -360,7 +362,7 @@ SPDX-License-Identifier: MPL-2.0
</svg>
</BrownButton>
<BrownButton
href="/api/v1/eximport/{quiz.id}"
on:click={() => (download_id = quiz.id)}
flex={true}
disabled={quiz.type !== 'quiz'}
><!-- heroicons/download -->
@@ -397,3 +399,4 @@ SPDX-License-Identifier: MPL-2.0
{#if start_game !== null}
<StartGamePopup bind:quiz_id={start_game} />
{/if}
<DownloadQuiz bind:quiz_id={download_id} />
@@ -5,6 +5,7 @@ SPDX-License-Identifier: MPL-2.0
-->
<script lang="ts">
import DownloadQuiz from '$lib/components/DownloadQuiz.svelte';
import { getLocalization } from '$lib/i18n';
import CollapsSection from '$lib/collapsible.svelte';
import { createTippy } from 'svelte-tippy';
@@ -29,6 +30,7 @@ SPDX-License-Identifier: MPL-2.0
});
let start_game = null;
let download_id: string | null = null;
const urlparams = $page.url.searchParams;
const mod_view = Boolean(urlparams.get('mod'));
const auto_expand = Boolean(urlparams.get('autoExpand'));
@@ -186,7 +188,7 @@ SPDX-License-Identifier: MPL-2.0
</div>
<div class="w-full">
{#if logged_in}
<GrayButton flex={true} href="/api/v1/eximport/{quiz.id}">
<GrayButton flex={true} on:click={() => (download_id = quiz.id)}>
<svg
class="w-5 h-5 inline-block"
fill="none"
@@ -341,3 +343,5 @@ SPDX-License-Identifier: MPL-2.0
{#if start_game !== null}
<StartGamePopup bind:quiz_id={start_game} />
{/if}
<DownloadQuiz bind:quiz_id={download_id} />