Skip to content

Commit 9582551

Browse files
refactor: Adapte code for Learning Path
1 parent 17e93cc commit 9582551

6 files changed

Lines changed: 114 additions & 243 deletions

File tree

components/CardSession.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ export default {
5555
var pathParts = stepPath.replace("/_dir", "");
5656
var id = pathParts.split("/");
5757
id = id[id.length - 1];
58+
59+
if (!pathParts.startsWith("/")) {
60+
pathParts = "/" + pathParts;
61+
}
62+
5863
const router = useRouter();
5964
router.push({
6065
path: pathParts.replace(id, ""),

components/nav.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<v-list>
3131
<v-list-item>
3232
<a
33-
href="https://github.com/IFB-ElixirFr/Wasm4Learn-doc"
33+
href="https://ifb-elixirfr.github.io/Wasm4Learn-doc/"
3434
target="_blank"
3535
style="all: unset; cursor: pointer"
3636
><v-list-item-title>Documentation</v-list-item-title></a

pages/courses-all.vue

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,16 @@
5252
</v-col>
5353
<v-col cols="2"
5454
><h3>Filters</h3>
55-
5655
<v-radio-group v-model="radioLang">
57-
<v-radio
58-
v-for="(l, kl) in lang"
59-
:key="kl"
60-
:label="l"
61-
:value="l"
62-
></v-radio>
56+
<div v-for="(type, kt) in filterDict" :key="kt">
57+
<p class="text-h6">{{ kt }}</p>
58+
<v-radio
59+
v-for="(t, kt) in type"
60+
:key="kt"
61+
:label="t"
62+
:value="t"
63+
></v-radio>
64+
</div>
6365
</v-radio-group>
6466

6567
<v-btn @click="filter" class="ma-2" block> Filter </v-btn>
@@ -74,7 +76,7 @@ import "/node_modules/flag-icons/css/flag-icons.min.css";
7476
7577
// Funtion to filter a json
7678
function filterJson(item) {
77-
return item.langName == this;
79+
return item.name == this;
7880
}
7981
8082
export default {
@@ -86,23 +88,37 @@ export default {
8688
8789
var data = [];
8890
var lang = [];
91+
var filterDict = {};
92+
8993
for (const [knL1, nL1] of Object.entries(navigation.value)) {
9094
for (const [kn, n] of Object.entries(nL1.children)) {
95+
if (!(nL1.title in filterDict)) {
96+
filterDict[nL1.title] = [];
97+
}
98+
filterDict[nL1.title].push(n.title);
9199
lang.push(n.title);
92-
for (const [kt, t] of Object.entries(n.children)) {
93-
for (const [kc, c] of Object.entries(t.children)) {
94-
var temp = c;
95-
temp["parentPath"] = t._path;
96-
temp["langImage"] = n.image;
97-
temp["langName"] = n.title;
98-
temp["type"] = t.title;
99-
data.push(temp);
100+
if (nL1.title === "Learning Path") {
101+
var temp = n;
102+
temp["parentPath"] = nL1._path;
103+
temp["name"] = n.title;
104+
temp["type"] = nL1.title;
105+
data.push(temp);
106+
} else {
107+
for (const [kt, t] of Object.entries(n.children)) {
108+
for (const [kc, c] of Object.entries(t.children)) {
109+
var temp = c;
110+
temp["parentPath"] = t._path;
111+
temp["langImage"] = n.image;
112+
temp["name"] = n.title;
113+
temp["type"] = t.title;
114+
data.push(temp);
115+
}
100116
}
101117
}
102118
}
103119
}
104120
105-
return { navigation, data, lang };
121+
return { navigation, data, lang, filterDict };
106122
},
107123
data() {
108124
return {

pages/index.vue

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@
109109
<v-sheet style="background-color: #0080bc" id="getStarted">
110110
<v-container class="pa-10 text-white text-center">
111111
<p class="text-h3 ma-5">
112-
<span style="color: #cddd00">Learning path</span> design by trainers
112+
<span style="color: #cddd00">Pedagogical content</span> design by
113+
trainers
113114
</p>
114115
<div v-for="(navel, key_navel) in navigation" :key="key_navel">
115-
<p class="text-h4">By {{ navel.title }}</p>
116-
<div class="d-flex flex-wrap justify-center">
116+
<p class="text-h4">By {{ navel.title }}</p>
117+
<div
118+
class="d-flex flex-wrap justify-center"
119+
v-if="navel.title != 'Learning Path'"
120+
>
117121
<v-card
118122
width="300px"
119123
class="ma-5 rounded-lg"
@@ -139,6 +143,30 @@
139143
</v-card-text>
140144
</v-card>
141145
</div>
146+
<div v-else class="d-flex flex-wrap justify-center">
147+
<v-card
148+
width="300px"
149+
class="ma-5 rounded-lg"
150+
v-for="(n, key) in navel.children"
151+
:key="key"
152+
@click="changePathLearningPath(navel._path, n._dir)"
153+
elevation="5"
154+
>
155+
<v-card-text class="d-flex flex-column" style="height: 100%">
156+
<div class="text-center mb-10" v-if="'image' in n">
157+
<img :src="n.image" alt="logo" style="height: 100px" />
158+
</div>
159+
<h1>{{ n.title }}</h1>
160+
<br />
161+
<p class="text-subtitle-1">{{ n.description }}</p>
162+
<br />
163+
<v-spacer></v-spacer>
164+
<div v-if="n.steps">
165+
<p><b>Number of sessions</b> : {{ n.steps.length }}</p>
166+
</div>
167+
</v-card-text>
168+
</v-card>
169+
</div>
142170
</div>
143171
</v-container>
144172
</v-sheet>
@@ -238,6 +266,10 @@ export default {
238266
const router = useRouter();
239267
router.push({ path: path + "/" });
240268
},
269+
changePathLearningPath(pathParent, dir) {
270+
const router = useRouter();
271+
router.push({ path: pathParent + "/", query: { id: dir } });
272+
},
241273
getSection(n) {
242274
if (n.children !== undefined) {
243275
return n.children.length;

pages/language/[lang]/learning-path/[...slug].vue

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)