commit: c99652067ffd4f8e869faf7027365224c14cc70b
parent 690207734eeb0083457be20cb19caadf4a9bf749
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Fri, 9 Mar 2018 14:56:21 +1300
Added document node
Diffstat:
9 files changed, 51 insertions(+), 43 deletions(-)
diff --git a/index.html b/index.html
@@ -12,6 +12,7 @@
<script src="scripts/nodes/indental.js"></script>
<script src="scripts/nodes/template.js"></script>
<script src="scripts/nodes/dom.js"></script>
+ <script src="scripts/nodes/document.js"></script>
<script src="scripts/database/ingredients.js"></script>
<script src="scripts/database/recipes.js"></script>
@@ -20,7 +21,6 @@
<script src="scripts/templates/recipe.js"></script>
<script src="scripts/templates/ingredient.js"></script>
<script src="scripts/templates/page.js"></script>
- <script src="scripts/templates/related.js"></script>
<script src="scripts/templates/home.js"></script>
<script src="scripts/templates/search.js"></script>
diff --git a/riven.html b/riven.html
@@ -13,18 +13,18 @@
<script src="scripts/nodes/indental.js"></script>
<script src="scripts/nodes/template.js"></script>
<script src="scripts/nodes/dom.js"></script>
+ <script src="scripts/nodes/document.js"></script>
- <script src="scripts/templates/recipe.js"></script>
- <script src="scripts/templates/ingredient.js"></script>
- <script src="scripts/templates/page.js"></script>
- <script src="scripts/templates/related.js"></script>
-
<script src="scripts/database/ingredients.js"></script>
<script src="scripts/database/recipes.js"></script>
<script src="scripts/database/pages.js"></script>
<script src="scripts/templates/home.js"></script>
<script src="scripts/templates/search.js"></script>
+ <script src="scripts/templates/recipe.js"></script>
+ <script src="scripts/templates/ingredient.js"></script>
+ <script src="scripts/templates/page.js"></script>
+
<link rel="stylesheet" type="text/css" href="links/reset.css"/>
<link rel="stylesheet" type="text/css" href="links/riven.fonts.css"/>
<link rel="stylesheet" type="text/css" href="links/riven.main.css"/>
diff --git a/scripts/graph.js b/scripts/graph.js
@@ -21,14 +21,15 @@ function graph()
])
Ø("client").mesh({x:32,y:0},[
- Ø("view").create({x:2,y:2},DomNode),
- Ø("header").create({x:2,y:8},DomNode),
- Ø("logo").create({x:2,y:14},DomNode,"wr",`<a href='#home' onclick="Ø('query').bang('home')" ><img src='media/interface/logo.png'/></a>`),
- Ø("menu").create({x:6,y:14},DomNode,"list"),
- Ø("core").create({x:10,y:8},DomNode),
- Ø("content").create({x:10,y:14},DomNode),
- Ø("related").create({x:14,y:14},DomNode,"list"),
- Ø("footer").create({x:6,y:8},DomNode),
+ Ø("document").create({x:2,y:2},DocumentNode),
+ Ø("view").create({x:2,y:6},DomNode),
+ Ø("header").create({x:2,y:11},DomNode),
+ Ø("logo").create({x:2,y:16},DomNode,"wr",`<a href='#home' onclick="Ø('query').bang('home')" ><img src='media/interface/logo.png'/></a>`),
+ Ø("menu").create({x:6,y:16},DomNode,"list"),
+ Ø("core").create({x:10,y:11},DomNode),
+ Ø("content").create({x:10,y:16},DomNode),
+ Ø("related").create({x:14,y:16},DomNode,"list"),
+ Ø("footer").create({x:6,y:11},DomNode),
])
// Model
@@ -39,7 +40,7 @@ function graph()
Ø("template").syphon(["recipe","ingredient","page"])
Ø("page").syphon(["home","search"])
- Ø("template").connect("view")
+ Ø("template").connect(["view","document"])
Ø("view").bind(["header","core","footer"])
Ø("core").bind(["content","related"])
Ø("header").bind(["logo","menu"])
diff --git a/scripts/nodes/document.js b/scripts/nodes/document.js
@@ -0,0 +1,12 @@
+function DocumentNode(id,rect,...params)
+{
+ Node.call(this,id,rect);
+
+ this.glyph = NODE_GLYPHS.dom
+
+ this.receive = function(content)
+ {
+ document.title = content.title
+ console.log(content)
+ }
+}+
\ No newline at end of file
diff --git a/scripts/nodes/template.js b/scripts/nodes/template.js
@@ -11,7 +11,7 @@ function TemplateNode(id,rect)
var assoc = this.signal(q.type ? q.type.slice(0, -1) : "page");
var payload = assoc.answer(q)
- this.send({view:payload})
+ this.send(payload)
this.label = `template:${assoc.id}`
// Install Dom
diff --git a/scripts/templates/home.js b/scripts/templates/home.js
@@ -10,8 +10,11 @@ function HomeTemplate(id,rect)
var sorted_ingredients = sort_ingredients(ingredients);
return {
- core: {
- content: make_ingredients(sorted_ingredients,q.tables.ingredients)
+ title:`GrimGrains — Home`,
+ view:{
+ core: {
+ content: make_ingredients(sorted_ingredients,q.tables.ingredients)
+ }
}
}
}
diff --git a/scripts/templates/ingredient.js b/scripts/templates/ingredient.js
@@ -11,9 +11,12 @@ function IngredientTemplate(id,rect)
var ingredient = t.result;
return {
- core: {
- content: make_ingredient(t.name,t.tables.recipes),
- related:make_related(related_recipes(t.name,t.tables.recipes))
+ title:`GrimGrains — ${t.name.capitalize()}`,
+ view: {
+ core: {
+ content: make_ingredient(t.name,t.tables.recipes),
+ related:make_related(related_recipes(t.name,t.tables.recipes))
+ }
}
}
}
diff --git a/scripts/templates/recipe.js b/scripts/templates/recipe.js
@@ -6,15 +6,18 @@ function RecipeTemplate(id,rect)
// Create the recipe body
- this.answer = function(q)
+ this.answer = function(t)
{
return {
- header:{
- search: q.name.capitalize()
- },
- core: {
- content: make_content(q),
- related: make_related(q)
+ title:`GrimGrains — ${t.name.capitalize()}`,
+ view:{
+ header:{
+ search: t.name.capitalize()
+ },
+ core: {
+ content: make_content(t),
+ related: make_related(t)
+ }
}
}
}
diff --git a/scripts/templates/related.js b/scripts/templates/related.js
@@ -1,14 +0,0 @@
-function RelatedTemplate(id,rect)
-{
- Node.call(this,id,rect);
-
- this.glyph = NODE_GLYPHS.render
-
- // Create the recipe body
-
- this.answer = function(t)
- {
- return ""
- return html
- }
-}-
\ No newline at end of file