Browse Source

update routes

pull/1/head
wes 8 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> <links>
<div class="links-content container animated fadeIn"> <div class="links-content container animated fadeIn">
<loading if={this.loading && this.opts.state.loaded}></loading>
<div class="columns"> <div class="columns">
<div class="column col-12"> <div class="column col-12">
<h3 class="text-center"> <h3 class="text-center">
@ -8,6 +7,7 @@
</h3> </h3>
</div> </div>
</div> </div>
<loading if={loading}></loading>
<div class="columns"> <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"> <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> <h5 class="text-center">{links.title}</h5>
@ -45,9 +45,10 @@ self.groups = []
getLinks() { getLinks() {
self.update({"loading" : true}); self.update({"loading" : true});
window.cached("/blog/links/") window.cached("/blog/glinks/")
.then((resp) => resp.text()) .then((resp) => resp.text())
.then((resp) => { .then((resp) => {
console.log(resp);
self.update( self.update(
{ {
"groups" : JSON.parse(resp), "groups" : JSON.parse(resp),

10
src/scripts/social.tag

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

30
src/website.py

@ -96,26 +96,36 @@ def NeverWhere(configfile=None):
page="posts", page="posts",
postcontent=dict(initial_post)) 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) @cache.cached(timeout=50)
@app.route("/blog/projects", methods=("GET",)) @app.route("/blog/projects", methods=("GET",))
def showProjects(): def showProjects():
return render_template("index.html", page="projects", postcontent=defaultdict(str)) 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) @cache.cached(timeout=50)
@app.route("/blog/", methods=("GET", "POST")) @app.route("/blog/", methods=("GET", "POST"))
def index(): def index():
return renderInitial() return renderInitial()
# get the next post # 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) @cache.cached(timeout=50)
@app.route("/blog/switchpost/<pid>/<category>") @app.route("/blog/switchpost/<pid>/<category>")
@ -181,7 +191,7 @@ def NeverWhere(configfile=None):
return posts.savepost(**post) return posts.savepost(**post)
@app.route("/blog/links/", methods=("GET",)) @app.route("/blog/glinks/", methods=("GET",))
def links(): def links():
""" """
Get links Get links

Loading…
Cancel
Save