A quiz with 4 questions, just one is correct. This repository is an optional module for the "lerntools". For installation and configuration, please see the documentation in https://codeberg.org/lerntools/base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

121 lines
4.3 KiB

<template>
<div>
<page-title :title="$t('title')" :subtitle="$t('subtitle')" :button="$t('manual')" buttonhref='#/text-abcd-help'/>
<div class="container mt-3">
<wait-icon v-if="loading"/>
<index-list
:items="allSets" :fields="['title','desc','subject','owner']"
:actions="['start','edit','share','duplicate','export','delete','import','new']"
role="abcd"
resturl="abcd/sets" restkey="abcd"
v-on:start="start" v-on:edit="edit" v-on:share="share" v-on:export="exportJson" v-on:reload="loadMeta"
v-on:new="showModalCreate=true" />
</div>
<modal-dialog v-show="showModalCreate" v-on:accept="create()" v-on:close="showModalCreate=false">
<template v-slot:header>{{$t('create-new-set')}}</template>
<p>{{$t('create-new-text1')}}</p>
<p>{{$t('create-new-text2')}}</p>
<div class="form-group">
<input class="form-control" v-model="createTitle" :placeholder="$t('hint-title')">
</div>
</modal-dialog>
<modal-share v-if="shareUrl" v-on:close="shareUrl=''" :url="shareUrl"/>
</div>
</template>
<script>
import PageTitle from 'Main/components/PageTitle.vue';
import ModalShare from 'Main/components/ModalShare.vue';
import ModalDialog from 'Main/components/ModalDialog.vue';
import WaitIcon from 'Main/components/WaitIcon.vue';
import IndexList from 'Main/components/ABCDList.vue';
import store from 'Main/js/store.js';
import download from 'Main/js/download.js';
import generator from 'Main/js/password-generator';
export default {
name: 'home',
components: { PageTitle, ModalShare, ModalDialog, WaitIcon, IndexList },
data: function() {
return {
allSets:[],
shareUrl:'',
loading:true,
hasRole:false,
//create
showModalCreate:false,
createTitle:''
}
},
mounted: function() {
this.hasRole=store.user.hasRole('abcd');
if (!this.hasRole) return this.$router.push({name:'abcd-login'});
this.loadMeta();
},
methods: {
share: function(set) {
var ticket=set.ticket;
var location=window.location.toString();
var base=location.substring(0,location.lastIndexOf('/'));
this.shareUrl=base+'/abcd-show/'+ticket;
},
start: function(set) {
this.$router.push({name:'abcd-run',params:{id:set._id}})
},
exportJson: async function(set) {
var abcd=await this.getSet(set)
download.downloadJson(abcd);
},
getSet: async function(set) {
var response=await this.$axios.get('abcd/sets/'+set._id);
var abcd=Object.assign({}, response.data);
//remove unecessary information
delete abcd._id;
delete abcd.__v;
delete abcd.owner;
for (var question of abcd.questions) {
delete question._id;
}
return abcd;
},
create: function() {
this.$router.push({name:'abcd-edit',params:{title:this.createTitle}})
},
edit: function(set) {
this.$router.push({name:'abcd-edit',params:{id:set._id}})
},
loadMeta: function() {
this.loading=true;
this.$axios.get('abcd/sets-meta').then(response=> {
this.allSets=response.data;
this.loading=false;
})
}
}
}
</script>
<i18n>
{
"de": {
"title": "ABCD-Quiz",
"subtitle": "Ein ABCD-Quiz beinhaltet eine Reihe von Fragen, zu denen jeweils 4 Antworten angezeigt werden – aber nur eine dieser Antworten ist korrekt. Alle Teilnehmer beantworten die Fragen der Reihe nach, wobei pro Frage immer nur eine gewisse Zeitspanne vorgesehen ist. Weitere Informationen und Tipps zur Bedienung finden Sie in der Anleitung.",
"manual": "Anleitung",
"create-new-set": "Neue Fragensammlung anlegen",
"create-new-text1": "Fragensammlungen, die von Ihnen als „öffentlich“ gekennzeichnet sind, stehen allen anderen Nutzern unter der Lizenz CC-BY-SA zur Verfügung.",
"create-new-text2": "Außerdem können Sie Fragensammlungen über ein Ticket den Teilnehmern per Link zur Verfügung stellen."
},
"en": {
"title": "ABCD-Quiz",
"subtitle": "An ABCD quiz contains a series of questions, each containing 4 answers - but only one is correct. All participants answer the questions in turn, with only one period of time per question. For more information and tips on how to use it, see the instructions.",
"manual": "Manual",
"create-new-set": "Create new question set",
"create-new-text1": "Question collections that you mark as public are available to all other users under the CC-BY-SA license.",
"create-new-text2": "In addition, you can provide a collection of questions about a ticket to the participants via a link."
}
}
</i18n>