Calculate/display workshop, lesson #, lesson total #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #62 and closes #70 by programmatically interpreting the route path to determine the shortname of the workshop ("Basics" or "Blog"), the lesson number, and the total number of lessons in the current workshop, without the author of a new workshop having to add this info explicitly. This also removes the need for the author to add a "last: true" property to make the button on the final lesson of the series work properly.
Note that the current solution will only work if we stick with our current pattern for paths (eg "/basics/02"), picking one-word shortnames for workshops. If we need to deviate from this pattern down the road, the "workshopShortname" calculated value will need to be adjusted, but this could be done without much difficulty if we consistently use hyphens or something like that to allow us to easily manipulate the string.
For now I'm doing a very simple presentation rather than a visual progress bar. (We can re-assess whether we want to do a progress bar once we build the ability to save state.) Here's the visual change you should see on each lesson page:
Updates:
Lesson.vue
, calculatelessonNumber
andworkshopShortname
from route path (removing trailing zeros in lesson number and
capitalizing first letter of workshop name)
Lesson.vue
, calculate totallessonsInWorkshop
byincrementing path and checking if that route exists until it doesn't
lessonNumber
equalslessonsInWorkshop
, so it's no longernecessary to pass a
last: true
(that property removed now from relevantlessons)
main.js
, adjust route names for consistency to include shortnameof workshop
boiler.vue
to match current needs