Add button to reopen survey

This commit is contained in:
Ramon Wenger 2019-07-24 15:22:53 +02:00
parent c81bcbd26b
commit fa72d8f5b8
2 changed files with 17 additions and 1 deletions

View File

@ -2,6 +2,9 @@
<div class="survey-page">
<h1 class="survey-page__title">{{title}}</h1>
<survey :survey='survey'></survey>
<div v-if="surveyComplete">
<a class="button button--primary" @click="reopen">Übung bearbeiten</a>
</div>
</div>
</template>
@ -28,6 +31,12 @@
}
},
computed: {
surveyComplete() {
return this.survey && this.survey.isCompleted
}
},
methods: {
initSurvey(data, answer) {
let survey = new SurveyVue.Model(data);
@ -72,6 +81,11 @@
survey.showProgressBar = 'bottom';
return survey;
},
reopen() {
let data = this.survey.data; // save the data
this.survey.clear();
this.survey.data = data; // reapply it
}
},
@ -110,6 +124,7 @@
max-width: 800px;
display: grid;
grid-template-rows: auto 1fr;
grid-auto-rows: 1fr;
grid-row-gap: $large-spacing;
justify-self: center;
padding: 100px 0;

View File

@ -91,7 +91,8 @@ const routes = [
path: '/survey/:id',
component: surveyPage,
name: 'survey',
props: true
props: true,
meta: {layout: 'simple'}
},
{path: '/styleguide', component: styleGuidePage},
{path: '*', component: p404}