RaspberryPiFoundation / lesson_format

Lesson formatter
18 stars 28 forks source link

Adding new terms #136

Closed rikcross closed 9 years ago

rikcross commented 9 years ago

Currently I'm putting any project not in the 'core' curriculum into the 'Additional ... projects' sections, and these sections are getting quite big.

screen shot 2015-02-03 at 13 21 15

It would be great if we had the flexibility to create new sections, which effectively worked in the same way that the 'Terms' section does (i.e. building projects from manifests, etc.)

This means that I could create a second 'additional terms' section, to distinguish it from the core curriculum (or maybe even a section per language). We could also create a 'third-party resources' section, for stuff like the TWSU projects, which are currently static here: https://www.codeclub.org.uk/twsu.

andylolz commented 9 years ago

@CodeClubRik: Apologies – I’m not sure I understand. It sounds like you’re after more terms. Like this?

screen shot 2015-02-03 at 13 47 18

If so, that’s currently possible. If not, can you explain how your requirement differs?

https://www.codeclub.org.uk/twsu

That URL doesn’t work for me…

rikcross commented 9 years ago

Hey @andylolz -- I mean additional entire sections, so we could have an 'additional projects' section underneath the current 'terms' section. I know that @Jonic set a version of this up, but additional sections can only be URLs and not manifests which build projects.

andylolz commented 9 years ago

I mean additional entire sections, so we could have an 'additional projects' section underneath the current 'terms' section

Like this?

screen shot 2015-02-03 at 14 09 32

Sorry – I find it much easier to understand with an image :) So… Here I’ve put the additional projects literally underneath terms, rather than underneath in the menu hierarchy sense.

rikcross commented 9 years ago

Yep, that kind of thing! :)

martinpeck commented 9 years ago

This is now done:

So, if you have something like this in the .manifest...

 {
    "description": false,
    "id": "scratch_01",
    "language": "en-GB",
    "number": 1,
    "title": "Scratch 1",
    "category": "cat-legacy",

... and you had something like this for the cat-legacy category in en-GB.languages...

{
    "code": "en-GB",
    "name": "English",
    "registration_note": {},
    "legal": {},
    "translations": {
        "cat-official": "Terms",
        "cat-official.description" : "",
        "cat-legacy" : "Additional Projects",
        "cat-legacy.description" : "These are additional projects"

Then the title "Additional Projects" with the text "These are additional projects" will appear above this term, and every subsequent term rendered unless those subsequent terms change the category.

By default, all of this is optional and can be omitted, leaving the old behaviour intact.

martinpeck commented 9 years ago

Fixed in SHA: f505b4857636284aaf4cae11b3d2e93363ad902c Minor modifications to metadata in SHA: 0c791857804c902c82b8325e1521a218ed973495

martinpeck commented 9 years ago

Sample output (with totally made up metadata) can be seen here:

image

andylolz commented 9 years ago

Nice!

One thing about using translations in this way… The fallback (when there’s no translation) becomes a key (e.g. “cat-official.description”) rather than the English text. This is only just worth mentioning, so I’m mentioning it :) The alternative would be to create a new sort of thing for categories (which would probably only result in more mess).

V nice though! I’ve commented on the commit directly with attempted answers to the questions in the comments.

martinpeck commented 9 years ago

Yeah...agreed. The use of translations is not ideal. My longer-term plan is to define the metadata for categories somewhere but this felt like the least-evil-while-getting-stuff-done way to give @CodeClubRik some more flexibility.

andylolz commented 9 years ago

Defos. Makes a lot of sense :+1: