Added download-button to public-quiz-view

This commit is contained in:
Mawoka
2022-12-01 17:44:02 +01:00
parent 352e26e6d6
commit 3d3b282776
2 changed files with 49 additions and 0 deletions
+1
View File
@@ -87,5 +87,6 @@ async def import_quiz(file: UploadFile = File(), user: User = Depends(get_curren
quiz_dict["cover_image"] = image_urls[-1]
quiz = Quiz.parse_obj(quiz_dict)
quiz.user_id = user.id
quiz.imported_from_kahoot = None
await quiz.save()
return quiz
@@ -108,11 +108,59 @@
{$t('words.practice')}
</a>
</div>
<div class="flex justify-center">
{#if logged_in}
<a
href="/api/v1/eximport/{quiz.id}"
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none"
>
<svg
class="w-5 h-5 inline-block"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/>
</svg>
Download
</a>
{:else}
<div use:tippy={{ content: 'You need to be logged in to download a game' }}>
<button
class="px-4 py-2 leading-5 text-white transition-colors duration-200 transform bg-gray-700 rounded text-center hover:bg-gray-600 focus:outline-none cursor-not-allowed opacity-50"
disabled
>
<svg
class="w-5 h-5 inline-block"
fill="none"
stroke="currentColor"
viewBox="0 0 24 24"
xmlns="http://www.w3.org/2000/svg"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"
/>
</svg>
Download
</button>
</div>
{/if}
</div>
<div class="flex justify-center">
<a href="mailto:report@mawoka.eu?subject=Report quiz {quiz.id}" class="text-sm underline">
{$t('words.report')}
</a>
</div>
{#each quiz.questions as question, index_question}
<div class="px-4 py-1">
<CollapsSection headerText={question.question}>