Skip to content

Commit 5192fd4

Browse files
committed
poc: integration d'un POIC
1 parent 5ad51ad commit 5192fd4

File tree

5 files changed

+100
-32
lines changed

5 files changed

+100
-32
lines changed

api/src/devcomp/infrastructure/datasources/learning-content/modules/bac-a-sable.json

+58-32
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"duration": 5,
1010
"level": "Débutant",
1111
"tabletSupport": "inconvenient",
12-
"objectives": ["Non régression fonctionnelle"]
12+
"objectives": [
13+
"Non régression fonctionnelle"
14+
]
1315
},
1416
"transitionTexts": [
1517
{
@@ -38,6 +40,23 @@
3840
}
3941
],
4042
"grains": [
43+
{
44+
"id": "a39ce6eb-f3db-447f-808f-aa6a06b940c9",
45+
"type": "lesson",
46+
"title": "test POIC",
47+
"components": [
48+
{
49+
"type": "element",
50+
"element": {
51+
"id": "f00133f5-0653-425b-a25f-3c9604820529",
52+
"type": "iframe",
53+
"title": "",
54+
"url": "https://1024pix.github.io/atelier-contenus/RPE/cartes2.html",
55+
"height": 420
56+
}
57+
}
58+
]
59+
},
4160
{
4261
"id": "0d4ef09a-ebb8-4514-a037-8fb22e540d7c",
4362
"type": "discovery",
@@ -231,8 +250,14 @@
231250
"id": "901ccbaa-f4e6-4322-b863-8e8eab08a33a",
232251
"type": "download",
233252
"files": [
234-
{ "url": "https://dl.pix.fr/1641899675462/Pix_velos.xlsx", "format": ".xlsx" },
235-
{ "url": "https://dl.pix.fr/1641899675463/Pix_velos.ods", "format": ".ods" }
253+
{
254+
"url": "https://dl.pix.fr/1641899675462/Pix_velos.xlsx",
255+
"format": ".xlsx"
256+
},
257+
{
258+
"url": "https://dl.pix.fr/1641899675463/Pix_velos.ods",
259+
"format": ".ods"
260+
}
236261
]
237262
}
238263
},
@@ -412,7 +437,11 @@
412437
"valid": "<span class=\"feedback__state\">Correct&#8239;!</span><p>Vous nous avez bien cernés&nbsp;:)</p>",
413438
"invalid": "<span class=\"feedback__state\">Et non&#8239;!</span><p> Pix sert à évaluer, certifier et développer ses compétences numériques.</p>"
414439
},
415-
"solutions": ["1", "3", "4"]
440+
"solutions": [
441+
"1",
442+
"3",
443+
"4"
444+
]
416445
}
417446
}
418447
]
@@ -476,8 +505,13 @@
476505
"placeholder": "",
477506
"ariaLabel": "Mot à trouver",
478507
"defaultValue": "",
479-
"tolerances": ["t1", "t3"],
480-
"solutions": ["Groupement"]
508+
"tolerances": [
509+
"t1",
510+
"t3"
511+
],
512+
"solutions": [
513+
"Groupement"
514+
]
481515
},
482516
{
483517
"type": "text",
@@ -493,7 +527,9 @@
493527
"ariaLabel": "Année à trouver",
494528
"defaultValue": "",
495529
"tolerances": [],
496-
"solutions": ["2016"]
530+
"solutions": [
531+
"2016"
532+
]
497533
}
498534
],
499535
"feedbacks": {
@@ -541,8 +577,14 @@
541577
"placeholder": "",
542578
"ariaLabel": "Remplir le prénom de la personne qui est en train de parler dans la visioconférence",
543579
"defaultValue": "",
544-
"tolerances": ["t1", "t2", "t3"],
545-
"solutions": ["Katie"]
580+
"tolerances": [
581+
"t1",
582+
"t2",
583+
"t3"
584+
],
585+
"solutions": [
586+
"Katie"
587+
]
546588
}
547589
],
548590
"feedbacks": {
@@ -594,8 +636,12 @@
594636
"placeholder": "",
595637
"ariaLabel": "Nom de ce produit",
596638
"defaultValue": "",
597-
"tolerances": ["t1"],
598-
"solutions": ["Modulix"]
639+
"tolerances": [
640+
"t1"
641+
],
642+
"solutions": [
643+
"Modulix"
644+
]
599645
}
600646
],
601647
"feedbacks": {
@@ -605,26 +651,6 @@
605651
}
606652
}
607653
]
608-
},
609-
{
610-
"id": "a39ce6eb-f3db-447f-808f-aa6a06b940c9",
611-
"type": "lesson",
612-
"title": "test POIC",
613-
"components": [
614-
{
615-
"type": "element",
616-
"element": {
617-
"id": "f00133f5-0653-425b-a25f-3c9604820529",
618-
"type": "embed",
619-
"isCompletionRequired": false,
620-
"title": "",
621-
"url": "https://1024pix.github.io/atelier-contenus/RPE/cartes2.html",
622-
"instruction": "",
623-
"solution": "",
624-
"height": 0
625-
}
626-
}
627-
]
628654
}
629655
]
630-
}
656+
}

api/src/devcomp/infrastructure/factories/module-factory.js

+12
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ export class ModuleFactory {
9797
return ModuleFactory.#buildWebComponent(element);
9898
case 'expand':
9999
return ModuleFactory.#buildExpand(element);
100+
case 'iframe':
101+
return ModuleFactory.#buildIframe(element);
100102
case 'image':
101103
return ModuleFactory.#buildImage(element);
102104
case 'separator':
@@ -140,6 +142,16 @@ export class ModuleFactory {
140142
});
141143
}
142144

145+
static #buildIframe(element) {
146+
return {
147+
id: element.id,
148+
title: element.title,
149+
url: element.url,
150+
height: element.height,
151+
type: 'iframe',
152+
};
153+
}
154+
143155
static #buildWebComponent(element) {
144156
return {
145157
...element,

mon-pix/app/components/module/component/element.gjs

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import DownloadElement from 'mon-pix/components/module/element/download';
55
import EmbedElement from 'mon-pix/components/module/element/embed';
66
import ExpandElement from 'mon-pix/components/module/element/expand';
77
import FlashcardsElement from 'mon-pix/components/module/element/flashcards/flashcards';
8+
import IframeElement from 'mon-pix/components/module/element/iframe';
89
import ImageElement from 'mon-pix/components/module/element/image';
910
import QcmElement from 'mon-pix/components/module/element/qcm';
1011
import QcuElement from 'mon-pix/components/module/element/qcu';
@@ -31,6 +32,8 @@ export default class ModulixElement extends Component {
3132
<DownloadElement @download={{@element}} @onDownload={{@onFileDownload}} />
3233
{{else if (eq @element.type "embed")}}
3334
<EmbedElement @embed={{@element}} @onAnswer={{@onElementAnswer}} />
35+
{{else if (eq @element.type "iframe")}}
36+
<IframeElement @iframe={{@element}} />
3437
{{else if (eq @element.type "web-component")}}
3538
<WebComponentElement @component={{@element}} @onAnswer={{@onElementAnswer}} />
3639
{{else if (eq @element.type "expand")}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import PixButton from '@1024pix/pix-ui/components/pix-button';
2+
import { action } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
4+
import { t } from 'ember-intl';
5+
6+
import { htmlUnsafe } from '../../../helpers/html-unsafe';
7+
import ModuleElement from './module-element';
8+
9+
export default class ModulixIframe extends ModuleElement {
10+
get heightStyle() {
11+
return htmlUnsafe(`height: ${this.args.iframe.height}px`);
12+
}
13+
14+
<template>
15+
<div class="element-embed">
16+
<div class="element-embed__container">
17+
<iframe
18+
class="element-embed-container__iframe"
19+
src={{@iframe.url}}
20+
title={{@iframe.title}}
21+
style={{this.heightStyle}}
22+
></iframe>
23+
</div>
24+
</div>
25+
</template>
26+
}

mon-pix/app/components/module/grain/grain.gjs

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default class ModuleGrain extends Component {
2222
'web-component',
2323
'expand',
2424
'flashcards',
25+
'iframe',
2526
'image',
2627
'qcu',
2728
'qcm',

0 commit comments

Comments
 (0)