Chapter menu reloading old content

Chapter menu reloading old content

by Nils Nilsson -
Number of replies: 5

I'm modifying the Snap theme. I modified the left-hand menu with the chapters. Adding a progress bar, for example. Now when the user marks an activity in the chapter as completed it updates the left-hand menu with the old content. I have searched for a reason why this might be, but I cannot find it. 

I'm adding before- and after images of my problem.



Average of ratings: -
In reply to Nils Nilsson

Re: Chapter menu reloading old content

by Guy Thomas -
Picture of Core developers Picture of Plugin developers

Hey Nils, nice idea!

We use a mustache template for the table of contents which I'm guessing you have updated.

This template is updated on request every time an activity is completed or manually marked as complete.

The new data (an array of chapter renderables) for the table of contents get's shipped via a web service - here is the renderable.


theme/snap/classes/renderables/course_toc_chapter.php


Have you modified this to include the percentage complete?

If so it might be that the renderable works fine with PHP but not via the web service.


I'm kind of guessing here but I hope I've given you some clues.

It'd really help if you could post your changes as a diff - e.g. via git hub.

In reply to Guy Thomas

Re: Chapter menu reloading old content

by Nils Nilsson -

Thanks for the reply. I'm overriding the class course_toc_progress in the file renderers.php in the snap root. When I tested it now the rendering was fine (same as it was before I completed) but the percentage didn't reach the new view fetched from the web service (I guess). 

I'm yet to figure out the whole cache-thing. I might be doing changes that actually works but is deeply cached? When making changes I'm emptying the moodle_data directory (except for the session folder) and clearing the theme cache. I've tried running in developer mode but it's so slow it's not doable.

In reply to Nils Nilsson

Re: Chapter menu reloading old content

by Guy Thomas -
Picture of Core developers Picture of Plugin developers

Hi Nils. Sounds like you are either

a) Using an old version of Snap

or

b) Need to delete the renderers.php file from the snap root


We now load the renderers via autoloading classes in theme/snap/classes

However, if you have upgraded to the latest version of Snap without deleting the old renderers.php file then it will still load the old file instead of using the classes in theme/snap/classes.


Please can you let me know the version of Snap you are using.

In reply to Guy Thomas

Re: Chapter menu reloading old content

by Nils Nilsson -

According to the version.php I'm using 3.1.3 ($plugin->release   = '3.1.3';)

I created the renderers.php file to avoid tempering with the native files. Are you suggesting editing the native files instead?