From 70adc3ba17bc0137058d504cb8c13248b56c33eb Mon Sep 17 00:00:00 2001 From: wes Date: Mon, 14 Aug 2017 09:51:16 -0400 Subject: [PATCH] fix doctype --- src/posts.py | 5 +++-- src/scripts/app.tag | 3 ++- src/scripts/links.tag | 9 ++++++--- src/templates/index.html | 5 ++--- src/website.py | 34 ++++++++++++++++++++++------------ 5 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/posts.py b/src/posts.py index d8c8378..5f88687 100644 --- a/src/posts.py +++ b/src/posts.py @@ -87,10 +87,11 @@ class Posts: return jsonify(posts) - def links(self): + def links(self, json=True): result = list(self.db.iterview("blogPosts/links", 1, include_docs=True)) if len(result) >= 1: - return jsonify(result[0].doc.get("links", [])) + xs = result[0].doc.get("links", []) + return jsonify(xs) if json else xs return [] def delete(self, _id): diff --git a/src/scripts/app.tag b/src/scripts/app.tag index 9fe98f3..6d88a76 100644 --- a/src/scripts/app.tag +++ b/src/scripts/app.tag @@ -129,7 +129,8 @@ self.state = { "author" : self.opts.author, "title" : self.opts.title, "loaded" : false, - "initial" : decodeURIComponent(self.opts.initial_post) + "initial" : decodeURIComponent(self.opts.initial_post), + "links" : JSON.parse(decodeURIComponent(self.opts.links)) }; self.active = lens.actives({ diff --git a/src/scripts/links.tag b/src/scripts/links.tag index 509610f..cb3f3db 100644 --- a/src/scripts/links.tag +++ b/src/scripts/links.tag @@ -43,14 +43,13 @@ var self = this; self.loading = false; -self.groups = [] +self.groups = self.opts.state.links; getLinks() { self.update({"loading" : true}); window.cached("/blog/glinks/") .then((resp) => resp.text()) .then((resp) => { - console.log(resp); self.update( { "groups" : JSON.parse(resp), @@ -59,7 +58,11 @@ getLinks() { }) } -self.on("mount", self.getLinks); +self.on("mount", () => { + if (self.opts.state.page != "links") { + self.getLinks(); + } +}); diff --git a/src/templates/index.html b/src/templates/index.html index 73fbc21..7cf1d85 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -1,4 +1,4 @@ - @@ -7,8 +7,7 @@ -

{{ test }}

-
+