logo

Grimgrains

Unnamed repository; edit this file 'description' to name the repository.
commit: a28464fb19626ec5417ed8d4fc6c5fa38c900ec3
parent 750d2b8dd6c4e66fa17ccce0b38c403fd170559d
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date:   Sat, 10 Mar 2018 10:16:11 +1300

Added list

Diffstat:

Mlinks/main.css4++++
Mscripts/templates/index.js32++++++++++++++++++++++++++++++--
2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/links/main.css b/links/main.css @@ -52,6 +52,10 @@ h1,h2,h3,h4 { font-weight: normal; font-family: 'alte_haas_grotesk_bold'; margin #view #core #related ln t.name { display: block; font-family: 'alte_haas_grotesk_bold'; font-size:16px; margin-bottom: 5px; text-transform: capitalize; line-height: 30px } #view #core #related ln t.details { display: block; font-family: 'alte_haas_grotesk_regular'; font-size:14px; text-transform: capitalize; line-height: 30px; line-height: 18px } +#view #core #content #index { columns:3; font-size:14px; font-weight: bold} +#view #core #content #index ln { display: block } + + #view #footer { display: block; padding:15px 0px;font-family: 'alte_haas_grotesk_bold'; font-size:12px; margin-top:60px; } #view #footer a:hover { text-decoration: underline; cursor: pointer } diff --git a/scripts/templates/index.js b/scripts/templates/index.js @@ -8,14 +8,42 @@ function IndexTemplate(id,rect) this.answer = function(q) { - console.log("!!") return { title:`GrimGrains — Index`, view:{ core: { - content: `Hello` + content: make_list(q.tables.recipes) } } } } + + function make_list(recipes) + { + var html = "" + + // Sort by tag + + var categorized = {} + + for(name in recipes){ + var recipe = recipes[name] + if(!categorized[recipe.TAGS[0]]){ categorized[recipe.TAGS[0]] = []; } + recipe.name = name + categorized[recipe.TAGS[0]].push(recipe) + } + + for(cat in categorized){ + var recipes = categorized[cat] + html += `<h3>${cat.capitalize()}</h3>` + html += "<list style='margin-bottom:15px'>" + for(id in recipes){ + var recipe = recipes[id] + html += `<ln>${recipe.name.capitalize()}</ln>` + + } + html += "</list>" + } + return `<columns id='index'>${html}</columns>`; + } } \ No newline at end of file