Skip to content

Commit ec941a1

Browse files
committed
18.2
[GTI] - preguntas del backup - permitir preguntas de varias fuentes, controles - mejoras de styling [general] - pequeñas correcciones y mejoras
1 parent 6ea8cbb commit ec941a1

8 files changed

Lines changed: 697 additions & 425 deletions

File tree

.eleventy.js

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module.exports = function (eleventyConfig) {
3737
return `<script src="${filepath.replace('src', '')}" defer></script>`;
3838
}
3939

40-
console.log(`JS file ${filename} not found in ./src/static/js`);
40+
console.log(`Script file ${filename}.js not found in /src/static/js/`);
4141
return '';
4242
});
4343

@@ -47,7 +47,7 @@ module.exports = function (eleventyConfig) {
4747
return `<link rel="stylesheet" href="${filepath.replace('src', '').replace('.sass', '.css')}">`;
4848
}
4949

50-
console.log(`CSS file ${filename} not found in ./src/static/css`);
50+
console.log(`Style file ${filename}.sass not found in /src/static/css/`);
5151
return '';
5252
});
5353

@@ -63,51 +63,64 @@ module.exports = function (eleventyConfig) {
6363
});
6464

6565
eleventyConfig.addShortcode("top", function() {
66-
return `
67-
<span id="top" class="button topbtn">top ↑</span>
68-
`;
66+
return `<span id="top" class="button topbtn">top ↑</span>`;
6967
});
7068

71-
eleventyConfig.addShortcode("questions", function(qs) {
72-
let template = ``;
69+
eleventyConfig.addShortcode("questions", function(json) {
70+
let blocks = ['socrative', 'backup'];
71+
let template = '<h3>preguntas.</h3> <ul>';
72+
blocks.forEach(b => {
73+
template += `<li><code>${b}</code>: ${json[b]['info']}</li>`
74+
});
75+
template += '<li><code>todas</code>: todas las preguntas</li></ul>';
7376

74-
qs.forEach((q, i) => {
75-
template += `
76-
<div class="question-block">
77-
<h2 class="question">
78-
${q.title}
79-
</h2>
80-
`;
77+
blocks.forEach((b) => {
78+
template += `<span class="button select-block" id="${b}">${b}</span>`
79+
});
8180

82-
if (q.options) {
83-
template += `<div class="options">`;
81+
template += `<span class="button select-block" id="all">todas</span>`;
82+
template += `<hr> <div id="questions">`;
8483

85-
q.options.forEach((o, j) => {
86-
template += `
87-
<h3 class="option">${j+1}. ${o}</h3>
88-
`;
89-
});
84+
blocks.forEach((block) => {
85+
let questions = json[block]['questions'];
9086

91-
template += `</div>`;
92-
}
87+
questions.forEach((q) => {
88+
template += `
89+
<div class="question-block" block="${block}">
90+
<h2 class="question">
91+
${q.title}
92+
</h2>
93+
`;
9394

94-
let shuffle = q.shuffle || true;
95+
if (q.options) {
96+
template += `<div class="options">`;
9597

96-
template += `<div class="answer-block" shuffle="${shuffle}">`;
97-
q.answers.forEach((a, j) => {
98-
template += `
99-
<span class="button answer${j == q.correct ? " correct" : ""}">
100-
${a}
101-
</span> <br>`;
102-
});
98+
q.options.forEach((o, j) => {
99+
template += `<h3 class="option">${j+1}. ${o}</h3>`;
100+
});
103101

104-
template += `
102+
template += `</div>`;
103+
}
104+
105+
let shuffle = q.shuffle || true;
106+
107+
template += `<div class="answer-block" shuffle="${shuffle}">`;
108+
q.answers.forEach((a, j) => {
109+
template += `
110+
<span class="button answer${j == q.correct ? " correct" : ""}">
111+
${a}
112+
</span> <br>`;
113+
});
114+
115+
template += `
116+
</div>
117+
${shuffle == "false" ? '<i>* orden de respuestas fijado</i>' : ''}
105118
</div>
106-
${shuffle == "false" ? '<i>* orden de respuestas fijado</i>' : ''}
107-
</div>
108-
`;
119+
`;
120+
});
109121
});
110122

123+
template += `</div>`;
111124
return template;
112125
});
113126

package.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)