logo

Grimgrains

[mirror] Plant-based cooking website <https://grimgrains.com/>
commit: 4cc393a6e78b2d1d905d87d3877d49222084aae5
parent 5cf84e03d45833f0636906c2b5d5c889ed9415f2
Author: microlith57 <microlith57@gmail.com>
Date:   Mon, 24 Jun 2019 15:17:08 +1200

Allow for accents in titles; make Celsius more visible

Signed-off-by: microlith57 <microlith57@gmail.com>

Diffstat:

Mscripts/templates/recipe.js11+++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/scripts/templates/recipe.js b/scripts/templates/recipe.js @@ -6,11 +6,13 @@ function RecipeTemplate (id, rect) { // Create the recipe body this.answer = function (t) { + let name = t.name + if (t.result && t.result.TITLE) {name = t.result.TITLE} return { - title: `GrimGrains — ${t.name.capitalize()}`, + title: `GrimGrains — ${name.capitalize()}`, view: { header: { - search: t.name.capitalize() + search: name.capitalize() }, core: { content: make_content(t), @@ -22,10 +24,11 @@ function RecipeTemplate (id, rect) { function make_content (q) { let recipe = q.result + let name = recipe.TITLE || q.name let html = '' html += ` - <h1 class='name'>${q.name.capitalize()}</h1> + <h1 class='name'>${name.capitalize()}</h1> <h2 class='serving'>${recipe.SERV} — ${recipe.TIME} minutes</h2> <hr /> @@ -56,7 +59,7 @@ function RecipeTemplate (id, rect) { function formatTemperature (temperature) { const celcius = (parseInt(temperature) - 32) / 1.8 - return `${temperature}°F(${parseInt(celcius / 10) * 10}°C)` + return `${temperature}°F / ${parseInt(celcius / 10) * 10}°C` } function convertTemperatures (content) {