Skip to content

Commit 3f3d3af

Browse files
committed
17.0 RC2
- new gti questions - allow download for projects - gti options for shuffling - styling fixes
1 parent 5bc941a commit 3f3d3af

8 files changed

Lines changed: 143 additions & 54 deletions

File tree

.eleventy.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function (eleventyConfig) {
2828
eleventyConfig.setDataFileSuffixes([".data", ""]);
2929
eleventyConfig.setQuietMode(true);
3030
eleventyConfig.setServerOptions({
31-
watch: ["_site/static/css/**"]
31+
watch: ["src/static/css/**"]
3232
});
3333

3434
eleventyConfig.addShortcode("addScript", function (filename) {
@@ -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(`JS file ${filename} not found in ./src/static/js`);
50+
console.log(`CSS file ${filename} not found in ./src/static/css`);
5151
return '';
5252
});
5353

@@ -91,6 +91,7 @@ module.exports = function (eleventyConfig) {
9191

9292
template += `
9393
</div>
94+
${shuffle == "false" ? '<i>* orden de respuestas fijado</i>' : ''}
9495
</div>
9596
`;
9697
});

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.

src/content/collections/projects/gti.data.json

Lines changed: 60 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
"correct": 0
153153
},
154154
{
155-
"title": "¿Qué palabra falta en la siguiente frase?: <i>\"La práctica Gestión del cambio organizacional trata de [?] la resistencia al cambio\"",
155+
"title": "¿Qué palabra falta en la siguiente frase?: <quote>\"La práctica Gestión del cambio organizacional trata de [?] la resistencia al cambio\"</quote>",
156156
"answers": [
157157
"influenciar",
158158
"mitigar",
@@ -192,15 +192,14 @@
192192
"correct": 0
193193
},
194194
{
195-
"title": "¿Qué tipo de aplicaciones gestiona la práctica \"Desarrollo y gestión de software\"?",
195+
"title": "¿Cuáles son los tipos de eventos?",
196196
"answers": [
197-
"Las desarrolladas internamente",
198-
"Las adquiridas",
199-
"Los dos tipos anteriores",
200-
"Otro tipo de aplicaciones"
197+
"Informativo, Reactivo, Normal",
198+
"Normal, Proactivo, Emergencia",
199+
"Informativo, Advertencia, Excepción",
200+
"Advertencia, Reactivo, Proactivo"
201201
],
202-
"correct": 2,
203-
"shuffle": "false"
202+
"correct": 2
204203
},
205204
{
206205
"title": "¿Qué práctica es la responsable de supervisar los recursos tecnológicos virtuales y/o físicos, como servidores, almacenamiento, redes, hardware de cliente, middleware y software de los sistemas operacionales, que proporcionan los entornos necesarios para entregar servicios de TI?",
@@ -223,14 +222,62 @@
223222
"correct": 2
224223
},
225224
{
226-
"title": "¿Cuáles son los tipos de eventos?",
225+
"title": "¿Qué tipo de aplicaciones gestiona la práctica \"Desarrollo y gestión de software\"?",
227226
"answers": [
228-
"Informativo, Reactivo, Normal",
229-
"Normal, Proactivo, Emergencia",
230-
"Informativo, Advertencia, Excepción",
231-
"Advertencia, Reactivo, Proactivo"
227+
"Las desarrolladas internamente",
228+
"Las adquiridas",
229+
"Los dos tipos anteriores",
230+
"Otro tipo de aplicaciones"
231+
],
232+
"correct": 2,
233+
"shuffle": "false"
234+
},
235+
{
236+
"title": "¿Cuál NO es acción principal en la práctica gestión de riesgos?",
237+
"answers": [
238+
"Tratamiento",
239+
"Evaluación",
240+
"Eliminación",
241+
"Identificación"
242+
],
243+
"correct": 2
244+
},
245+
{
246+
"title": "¿Cuál de las siguientes tareas en el proceso de gestión financiera NO se suele llevar a cabo cuando los clientes son internos?",
247+
"answers": [
248+
"Facturar",
249+
"Contabilizar",
250+
"Presupuestar",
251+
"Ninguna de los anteriores"
252+
],
253+
"correct": 0
254+
},
255+
{
256+
"title": "El proceso de Gestión de la Seguridad de la Información debe sensibilizar e informar sobre la política de seguridad de la información. ¿Cuáles son las personas afectadas por esta actividad?",
257+
"answers": [
258+
"Los propietarios y gestores de procesos",
259+
"Los directivos de la empresa, los directores de TI y el personal de gestión de la empresa",
260+
"Todos los clientes, usuarios y personal de TI",
261+
"Solo los actores del proceso de getsión de la seguridad de la información"
262+
],
263+
"correct": 2
264+
},
265+
{
266+
"title": "¿Cuál asistiría en la identificación y resolución de incidencias y problemas asociados con el rendimiento de un servicio o componente?",
267+
"answers": [
268+
"Gestión de proveedores",
269+
"Monitorización y gestión de eventos",
270+
"Gestión de la capacidad y el rendimiento",
271+
"Habilitación del cambio"
232272
],
233273
"correct": 2
234274
}
275+
],
276+
"author": "Juan Mier",
277+
"website": "https://mier.info/gti/",
278+
"location": "https://mier.info/content/collections/projects/gti.data.json",
279+
"contributors": [
280+
"Juan Mier",
281+
"Rubén Martínez"
235282
]
236283
}

src/content/collections/projects/gti.njk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ icons: [devicon-eleventy-plain, devicon-javascript-plain]
55
permalink: /gti/
66
demo: /gti/
77
source: https://github.com/search?q=repo%3Amiermontoto%2Fmiermontoto+gti.&type=code
8+
download: /content/collections/projects/gti.data.json
89
---
910

1011
{% addStyle 'gti' %}
@@ -17,6 +18,13 @@ source: https://github.com/search?q=repo%3Amiermontoto%2Fmiermontoto+gti.&type=c
1718
<noscript class=".error">ERROR: JavaScript is NEEDED for the quiz to work!</noscript>
1819
</div>
1920
<span class="button" id="reset">reset</span>
21+
<div id="options">
22+
<input type="checkbox" id="shuffle-questions" checked>
23+
<label for="shuffle">shuffle questions</label>
24+
<br>
25+
<input type="checkbox" id="shuffle-answers" checked>
26+
<label for="shuffle">shuffle answers</label>
27+
</div>
2028

2129
<hr>
2230
<div id="questions">

src/static/css/app/gti.sass

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,34 @@
33
.disabled.selected
44
background-color: base.$wrong
55

6-
76
.correct.selected
87
background-color: base.$correct
98

10-
119
.disabled
1210
background-color: base.$light
1311

14-
1512
.disabled.correct:not(.selected)
1613
background-color: base.$correct-background
1714

18-
1915
.question-block.correct
2016
border-color: base.$correct-background
2117

22-
2318
.question-block.wrong
2419
border-color: base.$wrong-background
2520

26-
2721
.disabled:hover
2822
cursor: auto
2923
animation: none
3024

31-
3225
#correct
3326
font-size: 5em
3427

35-
3628
#total
3729
font-size: 2.5em
3830

39-
4031
#top:hover
4132
cursor: alias
4233

43-
4434
.question-block
4535
margin: 0 auto
4636
width: 90%
@@ -49,7 +39,6 @@
4939
margin-bottom: 2em
5040
padding: 2em
5141

52-
5342
#results
5443
display: flex
5544
flex-direction: row
@@ -68,15 +57,15 @@
6857
#scored
6958
font-size: 2em
7059

71-
7260
#score
7361
font-size: 1.5em
7462

75-
76-
.button
63+
.button.disabled
7764
user-select: auto
7865

79-
8066
#→
8167
margin-left: 1em
8268
margin-right: 1em
69+
70+
.letter
71+
font-weight: bold

src/static/css/global.sass

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ a, a:visited
1616
&:hover
1717
animation: base.$animation
1818

19+
&.button
20+
color: base.$primary
21+
1922
.animated
2023
animation: base.$animation
2124

@@ -142,3 +145,8 @@ $rotation: 2.5rad
142145
color: base.$wrong
143146
font-weight: bold
144147
font-size: 2em
148+
149+
quote
150+
font-style: italic
151+
color: base.$white
152+
font-family: 'Times New Roman', Times, serif

src/static/js/app/gti.js

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,35 @@ const isCorrect = (ans) => ans.classList.contains('correct') && ans.classList.co
22
let responded = 0;
33
let total;
44

5+
let originalQuestions;
6+
57
window.addEventListener('load', () => { // when the page loads (the content is rendered)
68
resetAll();
79
document.querySelector('#reset').addEventListener('click', resetAll);
810
total = document.querySelectorAll('.question-block').length;
911
document.querySelector('#total').innerHTML = total;
12+
originalQuestions = document.querySelector('#questions').innerHTML;
1013

11-
// shuffle questions
12-
let questions = document.querySelectorAll('.question-block');
13-
let i = 1;
14-
shuffle(questions).forEach((q) => {
15-
document.querySelector('#questions').appendChild(q);
16-
let title = q.querySelector('.question');
17-
title.innerHTML = `${i++}. ${title.innerHTML}`; // add index to each question title
18-
});
14+
document.querySelectorAll('#shuffle-questions, #shuffle-answers').forEach((checkbox) => {
15+
checkbox.addEventListener('change', () => {
16+
document.querySelector('#questions').innerHTML = originalQuestions;
1917

20-
// shuffle 'shuffable' answer blocks
21-
document.querySelectorAll('.answer-block').forEach((block) => {
22-
let j = 0;
23-
if (block.getAttribute('shuffle') !== 'false') { // if it's shuffable
24-
block.querySelectorAll('br').forEach((br) => br.remove()); // remove all <br> tags
25-
let answers = block.querySelectorAll('.answer'); // get all answers
26-
shuffle(answers).forEach((ans) => { // shuffle them and for each
27-
block.appendChild(ans); // append them to the block
28-
block.appendChild(document.createElement('br')); // and add a <br> tag
29-
});
30-
}
18+
if (document.querySelector('#shuffle-questions').checked) {
19+
shuffleQuestions();
20+
}
21+
22+
if (document.querySelector('#shuffle-answers').checked) {
23+
shuffleAnswers();
24+
}
3125

32-
block.querySelectorAll('.answer').forEach((ans) => { // for each answer
33-
let letter = String.fromCharCode(97 + j); // convert index to letter
34-
ans.innerHTML = '<b>' + letter + '.</b> ' + ans.innerHTML; // add letter to answer
35-
j++;
26+
resetAll();
27+
recalc();
3628
});
3729
});
30+
31+
shuffleQuestions();
32+
shuffleAnswers();
33+
recalc();
3834
});
3935

4036
window.addEventListener('scroll', () => {
@@ -50,6 +46,43 @@ window.addEventListener('scroll', () => {
5046
}
5147
});
5248

49+
function recalc() {
50+
let i = 1;
51+
document.querySelectorAll('.question').forEach((q) => {
52+
q.innerHTML = `<span class="number">${i++}.</span> ${q.innerHTML}`; // add index to each question title
53+
});
54+
55+
document.querySelectorAll('.answer-block').forEach((block) => { // for each answer block
56+
let j = 0;
57+
block.querySelectorAll('.answer').forEach((ans) => { // for each answer
58+
let letter = String.fromCharCode(97 + j++); // convert index to letter
59+
ans.innerHTML = `<span class="letter">${letter}.</span>${ans.innerHTML}`; // add letter to answer
60+
});
61+
});
62+
}
63+
64+
// shuffle questions
65+
function shuffleQuestions() {
66+
let questions = document.querySelectorAll('.question-block');
67+
shuffle(questions).forEach((q) => {
68+
document.querySelector('#questions').appendChild(q);
69+
});
70+
}
71+
72+
// shuffle 'shuffable' answer blocks
73+
function shuffleAnswers() {
74+
document.querySelectorAll('.answer-block').forEach((block) => {
75+
if (block.getAttribute('shuffle') !== 'false') { // if it's shuffable
76+
block.querySelectorAll('br').forEach((br) => br.remove()); // remove all <br> tags
77+
let answers = block.querySelectorAll('.answer'); // get all answers
78+
shuffle(answers).forEach((ans) => { // shuffle them and for each
79+
block.appendChild(ans); // append them to the block
80+
block.appendChild(document.createElement('br')); // and add a <br> tag
81+
});
82+
}
83+
});
84+
}
85+
5386
function disableBlock(block) {
5487
block.querySelectorAll('.answer').forEach((ans) => {
5588
ans.removeEventListener('click', handleAnswerClick);

src/templates/project.njk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ css: project
99
<a href="{{ source }}" id="source">source code ></a>
1010
{% endif %}
1111
<h1>{{ title }}</h1>
12+
{% if download %}
13+
<a class="button" id="download" href="{{ download }}"><i class="fa-solid fa-download"></i>download</a>
14+
{% endif %}
1215
<hr>
1316
{% if content %}
1417
{{ content | safe }}

0 commit comments

Comments
 (0)