Skip to content

Calculate/display workshop, lesson #, lesson total #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 20, 2018

Conversation

terichadbourne
Copy link
Member

@terichadbourne terichadbourne commented Nov 16, 2018

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:

image

Updates:

  • In Lesson.vue, calculate lessonNumber and workshopShortname
    from route path (removing trailing zeros in lesson number and
    capitalizing first letter of workshop name)
  • In Lesson.vue, calculate total lessonsInWorkshop by
    incrementing path and checking if that route exists until it doesn't
  • Calculate whether you're in the final lesson by checking if
    lessonNumber equals lessonsInWorkshop, so it's no longer
    necessary to pass a last: true (that property removed now from relevant
    lessons)
  • In main.js, adjust route names for consistency to include shortname
    of workshop
  • Update boiler.vue to match current needs
  • Display "Workshop | Lesson X of Y" under lesson name

- In `Lesson.vue`, calculate `lessonNumber` and `workshopShortname`
from route path (removing trailing zeros in lesson number and
capitalizing first letter of workshop name)
- In `Lesson.vue`, calculate total `lessonsInWorkshop `by
incrementing path and checking if that route exists until it doesn't
- Calculate whether you're in the final lesson by checking if
`lessonNumber` equals `lessonsInWorkshop`, so it's no longer
necessary to pass a `last: true` (that property removed now from relevant
lessons)
- In `main.js`, adjust route names for consistency to include shortname
of workshop
- Update `boiler.vue` to match current needs
- Display "Workshop | Lesson X of Y" under lesson name
- Update README to explain how the route will be parsed to display
the workshop shortname, lesson number, and total number of lessons in
the workshop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants