Skip to content

Commit 4d7995c

Browse files
committed
poc: integration d'un POIC
1 parent 5ad51ad commit 4d7995c

File tree

5 files changed

+103
-32
lines changed

5 files changed

+103
-32
lines changed

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

+61-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,26 @@
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+
"isCompletionRequired": false,
54+
"title": "",
55+
"url": "https://1024pix.github.io/atelier-contenus/RPE/cartes2.html",
56+
"instruction": "",
57+
"solution": "",
58+
"height": 420
59+
}
60+
}
61+
]
62+
},
4163
{
4264
"id": "0d4ef09a-ebb8-4514-a037-8fb22e540d7c",
4365
"type": "discovery",
@@ -231,8 +253,14 @@
231253
"id": "901ccbaa-f4e6-4322-b863-8e8eab08a33a",
232254
"type": "download",
233255
"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" }
256+
{
257+
"url": "https://dl.pix.fr/1641899675462/Pix_velos.xlsx",
258+
"format": ".xlsx"
259+
},
260+
{
261+
"url": "https://dl.pix.fr/1641899675463/Pix_velos.ods",
262+
"format": ".ods"
263+
}
236264
]
237265
}
238266
},
@@ -412,7 +440,11 @@
412440
"valid": "<span class=\"feedback__state\">Correct&#8239;!</span><p>Vous nous avez bien cernés&nbsp;:)</p>",
413441
"invalid": "<span class=\"feedback__state\">Et non&#8239;!</span><p> Pix sert à évaluer, certifier et développer ses compétences numériques.</p>"
414442
},
415-
"solutions": ["1", "3", "4"]
443+
"solutions": [
444+
"1",
445+
"3",
446+
"4"
447+
]
416448
}
417449
}
418450
]
@@ -476,8 +508,13 @@
476508
"placeholder": "",
477509
"ariaLabel": "Mot à trouver",
478510
"defaultValue": "",
479-
"tolerances": ["t1", "t3"],
480-
"solutions": ["Groupement"]
511+
"tolerances": [
512+
"t1",
513+
"t3"
514+
],
515+
"solutions": [
516+
"Groupement"
517+
]
481518
},
482519
{
483520
"type": "text",
@@ -493,7 +530,9 @@
493530
"ariaLabel": "Année à trouver",
494531
"defaultValue": "",
495532
"tolerances": [],
496-
"solutions": ["2016"]
533+
"solutions": [
534+
"2016"
535+
]
497536
}
498537
],
499538
"feedbacks": {
@@ -541,8 +580,14 @@
541580
"placeholder": "",
542581
"ariaLabel": "Remplir le prénom de la personne qui est en train de parler dans la visioconférence",
543582
"defaultValue": "",
544-
"tolerances": ["t1", "t2", "t3"],
545-
"solutions": ["Katie"]
583+
"tolerances": [
584+
"t1",
585+
"t2",
586+
"t3"
587+
],
588+
"solutions": [
589+
"Katie"
590+
]
546591
}
547592
],
548593
"feedbacks": {
@@ -594,8 +639,12 @@
594639
"placeholder": "",
595640
"ariaLabel": "Nom de ce produit",
596641
"defaultValue": "",
597-
"tolerances": ["t1"],
598-
"solutions": ["Modulix"]
642+
"tolerances": [
643+
"t1"
644+
],
645+
"solutions": [
646+
"Modulix"
647+
]
599648
}
600649
],
601650
"feedbacks": {
@@ -605,26 +654,6 @@
605654
}
606655
}
607656
]
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-
]
628657
}
629658
]
630-
}
659+
}

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)