commit: f5f73908db3008e45d84291538a9a29728af3077
parent dafc17eddf83b96554bc985ba6b050b1844e2026
Author: Rekka <rekkabell@gmail.com>
Date: Thu, 15 Mar 2018 09:21:48 +1300
Merge branch 'master' of https://github.com/hundredrabbits/Grimgrains
Diffstat:
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/links/main.css b/links/main.css
@@ -47,7 +47,7 @@ h1,h2,h3,h4 { font-weight: normal; font-family: 'alte_haas_grotesk_bold'; margin
#view #core #content list.ingredients ln.ingredient { width: 100px;margin-left:-20px;min-height: 210px;display: inline-block;text-align: center;vertical-align: top;border: 2px dashed transparent;border-radius: 10px; }
#view #core #content list.ingredients ln.ingredient:hover { border-color: black; cursor: pointer; background:white; z-index:900; position: relative; }
#view #core #content list.ingredients ln.ingredient:hover t.name { text-decoration: underline; }
-#view #core #content list.ingredients ln.ingredient.missing t.name { color:red; }
+#view #core #content list.ingredients ln.ingredient.missing t.name { font-style: italic }
#view #core #content list.ingredients ln.ingredient img { max-width: 100% }
#view #core #content list.ingredients ln.ingredient t.name { display: block; font-family: 'alte_haas_grotesk_bold'; font-size:14px; margin-bottom: 5px;padding:0px 10px }
#view #core #content list.ingredients ln.ingredient t.quantity { display: block; font-size:12px; }
diff --git a/scripts/database/ingredients.js b/scripts/database/ingredients.js
@@ -507,6 +507,7 @@ Fenugreek
~ WHOLEGRAINS
+Whole wheat flour
Buckwheat
Details : [#875A2C noodles flour cookies pancakes] Missing.
Buckwheat noodles
diff --git a/scripts/nodes/indental.js b/scripts/nodes/indental.js
@@ -1,7 +1,8 @@
-function IndentalNode(id,rect)
+function IndentalNode(id,rect,type)
{
Node.call(this,id,rect);
+ this.type = type;
this.glyph = NODE_GLYPHS.database
this.answer = function(q)
@@ -13,15 +14,17 @@ function IndentalNode(id,rect)
if(this.cache){
return this.cache;
}
- this.cache = parse(DATABASE[this.id])
+
+ this.label = this.type ? `${this.id}=${this.type.name}` : `${this.id}`;
+ this.cache = parse(DATABASE[this.id],this.type)
return this.cache;
}
- function parse(data)
+ function parse(data,type)
{
- return build(data.split("\n").map(liner))
+ return build(data.split("\n").map(liner),type)
- function build(lines)
+ function build(lines,type)
{
// Assoc lines
var stack = {}
@@ -39,7 +42,8 @@ function IndentalNode(id,rect)
for(id in lines){
var line = lines[id];
if(line.skip || line.indent > 0){ continue; }
- h[line.content.toUpperCase()] = format(line)
+ var key = line.content.toUpperCase()
+ h[key] = type ? new type(key,format(line)) : format(line)
}
return h
}
@@ -51,7 +55,7 @@ function IndentalNode(id,rect)
for(id in line.children){
var child = line.children[id];
if(child.key){ h[child.key.toUpperCase()] = child.value }
- else if(child.children.length == 0){ a.push(child.content) }
+ else if(child.children.length == 0 && child.content){ a.push(child.content) }
else{ h[child.content.toUpperCase()] = format(child) }
}
return a.length > 0 ? a : h
diff --git a/scripts/templates/home.js b/scripts/templates/home.js
@@ -7,6 +7,9 @@ function HomeTemplate(id,rect)
this.answer = function(q)
{
var ingredients = find_ingredients(q.tables.recipes)
+
+ ingredients['coffee'] = 1
+
var sorted_ingredients = sort_ingredients(ingredients);
return {