Custom Theme - EditTemplates

Custom Theme - EditTemplates

by Pierpaolo Nappo -
Number of replies: 3
Hi Guys,
I'm reading the documentation, I've making a custom theme based on classic, so now I should edit the style ok ?
For examople now I should edit the footer, I'm editing the pre.scss and post.scss that I have created and I followed this on the doc (Override a Template in My Theme) so I've created the fooledr "Templates" and inside another folder "theme_boost" with "footer.mustache" file.

If I edit that, it's ok, I see the changes in real time, I'm in designer mode.
But I have 2 problems:

  1.  If I delete some existing raw in template, and replace these with my html/css I have a lot of problem on the admin panel (for example It doesn't show me the drop menu for log out ecc ecc) so I'm writing my code below the older (I see also that If I write in css: width: calc(100% / 3); grunt doesn't compile in css... I have an error why? So I write: width: (100% / 3) and it works)
  2. The example context (json) doesn't works... I tried a very basic example. Why?  The element in the Dom i always empty (row 30 in footer.mustache).
    I send you my files
Average of ratings: -
In reply to Pierpaolo Nappo

Re: Custom Theme - EditTemplates

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

In order to get your template to be listed in the Template library, I had to move the file from /theme/federica/templates/theme_boost/footer.mustache to /theme/federica/templates/footer.mustache. I think that, since only one theme is active at a time, you aren't actually overriding the template from the boost theme, so it doesn't go in a theme_boost subdirectory.

In your template, you have a paragraph of text ("Nota:...") following the example context. Moving this above the "Example context (json):" allows it to render correctly in the Template library. I think that the library takes everything following the "Example context (json):" line to be the example context, if anything following it is not valid JSON it will break, so any other documentation should go before this line.

Average of ratings: Useful (1)