Skip to content

Commit 35a3295

Browse files
From last lesson of series, link to workshop list
- Addresses issues #64 & #38, in which the the "Next" button appeared on the last lesson in a series and directed the user to a non-existent subsequent lesson. This is resolved by now showing instead a "More Workshops" button that goes back to the main list of all workshops so the user can choose what they'd like to do next. - In `Lesson.vue`, change the conditionals for success buttons to include an option (when the solution is correct and `last` has a value of ``"true"`) that loads a button with the text "More Workshops," bound to a new function `workshopMenu` that clears the output and directs the user to the main page, rather than incrementing the lesson number. - In Basics lesson 3 and Blog lesson 7 (the last of each series), follow the steps listed below. - WHEN CREATING THE LAST LESSON OF A NEW WORKSHOP: Add `last="true"` to the values being passed to the Lesson component. Use the success message "Great job! You've completed this series of lessons!" or something else that makes it clear this was the last lesson in the series. The button will populate automatically.
1 parent aba940f commit 35a3295

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/components/Lesson.vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,10 @@
8686
</div>
8787
</div>
8888
<div class="pt3 ph2 tr">
89-
<div v-if="output.test && output.test.success">
89+
<div v-if="output.test && output.test.success && last === 'true'">
90+
<Button v-bind:click="workshopMenu" class="bg-aqua white">More Workshops</Button>
91+
</div>
92+
<div v-else-if="output.test && output.test.success">
9093
<Button v-bind:click="next" class="bg-aqua white">Next</Button>
9194
</div>
9295
<div v-else>
@@ -173,6 +176,7 @@ export default {
173176
text: self.$attrs.text,
174177
exercise: self.$attrs.exercise,
175178
concepts: self.$attrs.concepts,
179+
last: self.$attrs.last,
176180
code: self.$attrs.code || defaultCode,
177181
parsedText: marked(self.$attrs.text),
178182
parsedExercise: marked(self.$attrs.exercise || ''),
@@ -258,6 +262,10 @@ export default {
258262
let next = (parseInt(current) + 1).toString().padStart(2, '0')
259263
this.$router.push({path: next})
260264
},
265+
workshopMenu: function () {
266+
Vue.set(this.output, 'test', null)
267+
this.$router.push({path: '/'})
268+
},
261269
toggleExpandExercise: function () {
262270
this.expandExercise = !this.expandExercise
263271
}

src/lessons/Basics/03.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
:validate="validate"
55
:modules="modules"
66
:exercise="exercise"
7-
lessonTitle="Reading data in links">
7+
lessonTitle="Reading data in links"
8+
last="true">
89
</Lesson>
910
</div>
1011
</template>
@@ -37,7 +38,7 @@ const validate = async (result, ipfs) => {
3738
}
3839
3940
if (result.value === 1 && result.remainderPath === '') {
40-
return {success: 'Great job!'}
41+
return {success: "Great job! You've completed this series of lessons!"}
4142
} else {
4243
let expected = JSON.stringify({value: 1, remainderPath: ''})
4344
let got = JSON.stringify(result)

src/lessons/Blog/07.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
:validate="validate"
55
:modules="modules"
66
:exercise="exercise"
7-
lessonTitle="Hop through nodes">
7+
lessonTitle="Hop through nodes"
8+
last="true">
89
</Lesson>
910
</div>
1011
</template>
@@ -170,7 +171,7 @@ const validate = async (result, ipfs) => {
170171
} catch (err) {
171172
return {fail: `Your function threw an error: ${err}.`}
172173
}
173-
return {success: 'Everything works!'}
174+
return {success: "Great job! You've completed this series of lessons!"}
174175
}
175176
176177
let modules = {cids: require('cids')}

0 commit comments

Comments
 (0)