Browse Source

update routes

pull/1/head
wes 7 years ago
parent
commit
cfbf7bba65
  1. 5
      src/scripts/links.tag
  2. 10
      src/scripts/social.tag
  3. 30
      src/website.py

5
src/scripts/links.tag

@ -1,6 +1,5 @@
<links>
<div class="links-content container animated fadeIn">
<loading if={this.loading && this.opts.state.loaded}></loading>
<div class="columns">
<div class="column col-12">
<h3 class="text-center">
@ -8,6 +7,7 @@
</h3>
</div>
</div>
<loading if={loading}></loading>
<div class="columns">
<div each={links in groups} class="column col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-4">
<h5 class="text-center">{links.title}</h5>
@ -45,9 +45,10 @@ self.groups = []
getLinks() {
self.update({"loading" : true});
window.cached("/blog/links/")
window.cached("/blog/glinks/")
.then((resp) => resp.text())
.then((resp) => {
console.log(resp);
self.update(
{
"groups" : JSON.parse(resp),

10
src/scripts/social.tag

@ -36,10 +36,12 @@ updateButton(_id, title) {
loadButtons() {
console.log("trying to load buttons");
if (window.twttr.widgets !== undefined) {
console.log("twitter was defined");
window.twttr.widgets.load(self.refs.twitter.root);
}
window.twttr.ready(() => {
if (window.twttr.widgets !== undefined) {
console.log("twitter was defined");
window.twttr.widgets.load(self.refs.twitter.root);
}
});
if (FB !== undefined && FB.XFBML !== undefined) {
FB.XFBML.parse(self.refs.facebook.root);

30
src/website.py

@ -96,26 +96,36 @@ def NeverWhere(configfile=None):
page="posts",
postcontent=dict(initial_post))
@app.route("/blog/posts/<_id>", methods=("GET",))
def renderPost(_id):
post_content = loads(
cacheit(_id,
lambda: dumps(posts.getpost(_id, json=False)))
)
return render_template("index.html", page="posts", postcontent=dict(post_content))
@cache.cached(timeout=50)
@app.route("/blog/projects", methods=("GET",))
def showProjects():
return render_template("index.html", page="projects", postcontent=defaultdict(str))
@cache.cached(timeout=50)
@app.route("/blog/links", methods=("GET",))
def showLinks():
return render_template("index.html", page="links", postcontent=defaultdict(str))
@cache.cached(timeout=50)
@app.route("/blog/about", methods=("GET",))
def showAbout():
return render_template("index.html", page="about", postcontent=defaultdict(str))
@cache.cached(timeout=50)
@app.route("/blog/", methods=("GET", "POST"))
def index():
return renderInitial()
# get the next post
@app.route("/blog/posts/<_id>", methods=("GET",))
def renderPost(_id):
post_content = loads(
cacheit(_id,
lambda: dumps(posts.getpost(_id, json=False)))
)
return render_template("index.html", page="posts", postcontent=dict(post_content))
@cache.cached(timeout=50)
@app.route("/blog/switchpost/<pid>/<category>")
@ -181,7 +191,7 @@ def NeverWhere(configfile=None):
return posts.savepost(**post)
@app.route("/blog/links/", methods=("GET",))
@app.route("/blog/glinks/", methods=("GET",))
def links():
"""
Get links

Loading…
Cancel
Save