Allow the user to place cards in rows with previous missing elements
Closes #8
This commit is contained in:
parent
cfed3d3d0a
commit
f4ce288914
21
index.html
21
index.html
@ -24,16 +24,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<template v-for="(elem, row) in solution">
|
<template v-for="(elem, row) in solution">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div
|
<template v-for="(idx, column) in elem.idx"><div
|
||||||
v-for="(idx, column) in elem.idx"
|
v-if="idx != null"
|
||||||
class="card"
|
class="card"
|
||||||
v-bind:class="{incorrect: column == store.section && incorrects[row], revealed: column == store.section && elem.got_revealed}"
|
v-bind:class="{incorrect: column == store.section && incorrects[row], revealed: column == store.section && elem.got_revealed}"
|
||||||
>
|
>
|
||||||
<span>{{ solution_text(elem, column) }}</span>
|
<span>{{ solution_text(elem, column) }}</span>
|
||||||
<svg width=20 height=20 v-if="column == store.section && !solution_correct" v-on:click="remove_solution(row)">
|
<svg width=20 height=20 v-if="column == store.section && !solution_correct" v-on:click="remove_solution(row)">
|
||||||
<path d="M2 2L18 18M18 2L2 18" stroke="#f00" stroke-width="2px" />
|
<path d="M2 2L18 18M18 2L2 18" stroke="#f00" stroke-width="2px" />
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div><div v-if="idx == null" class="card_placeholder">
|
||||||
|
</div></template>
|
||||||
<svg v-if="elem.idx.length == store.section && store.selected != null" v-on:click="add_card_to(row)" class="plus" width="20" height="20">
|
<svg v-if="elem.idx.length == store.section && store.selected != null" v-on:click="add_card_to(row)" class="plus" width="20" height="20">
|
||||||
<path d="M8 0H12V8H20V12H12V20H8V12H0V8H8Z" fill="#2b8856" />
|
<path d="M8 0H12V8H20V12H12V20H8V12H0V8H8Z" fill="#2b8856" />
|
||||||
</svg>
|
</svg>
|
||||||
|
4
quiz.css
4
quiz.css
@ -91,6 +91,10 @@ body {
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
width: calc(16.667vw - 50.5px);
|
width: calc(16.667vw - 50.5px);
|
||||||
}
|
}
|
||||||
|
#quiz .card_placeholder {
|
||||||
|
display: inline-block;
|
||||||
|
width: calc(16.667vw - 30.5px);
|
||||||
|
}
|
||||||
#quiz .card span {
|
#quiz .card span {
|
||||||
white-space: pre-line;
|
white-space: pre-line;
|
||||||
}
|
}
|
||||||
|
3
quiz.js
3
quiz.js
@ -398,6 +398,9 @@ var app = new Vue({
|
|||||||
this.correction_visible = false;
|
this.correction_visible = false;
|
||||||
this.solution.forEach(elem => {
|
this.solution.forEach(elem => {
|
||||||
elem.got_revealed = false;
|
elem.got_revealed = false;
|
||||||
|
if (elem.idx.length < this.store.section) {
|
||||||
|
elem.idx.push(null);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
add_card_to: function(row) {
|
add_card_to: function(row) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user