Browse Source

cleanup

pull/1/head
wes 7 years ago
parent
commit
b0ba997a1f
  1. 5
      src/scripts/app.tag
  2. 15
      src/scripts/post.tag
  3. 15
      src/website.py

5
src/scripts/app.tag

@ -145,8 +145,6 @@ RiotControl.on("postswitch",
}
);
self.route.base('/blog/')
self.state = {
"_id" : self.opts.postid.slice(-hashLength),
"author" : self.opts.author,
@ -197,8 +195,6 @@ var about = activate("about");
var links = activate("links");
function posts(_id) {
console.log("XXX");
console.log(_id);
if (self.state._id != _id) {
self.state._id = _id;
}
@ -224,6 +220,7 @@ to(name) {
}).bind(this);
}
self.route.base('/blog/')
self.route("/", () => { self.route(`/posts/${self.state._id}`); });
self.route("/posts", () => { self.route(`/posts/${self.state._id}`); });
self.route("posts/*", posts);

15
src/scripts/post.tag

@ -173,22 +173,7 @@ prevPost(_id) {
})
}
getPost(_id) {
self.update({"loading" : true});
var url;
if (_id !== undefined && _id) {
url = "/blog/getpost/"+_id.slice(-hashLength)+"/"+self.category;
}
else {
url = "/blog/switchpost/";
}
self.opts.cached(url)
.then((resp) => resp.text())
.then((resp) => { self.updatePost(JSON.parse(resp)) })
}
self.on("mount", () => {
//self.getPost(self.opts.state._id);
self.update({
"loading" : false
});

15
src/website.py

@ -79,6 +79,7 @@ def NeverWhere(configfile=None):
def stuff():
return render_template("projects.html")
# blog post routes
@app.route("/blog/posts/", methods=("GET",))
def renderInitial():
post_content = posts.getinitial()
@ -93,25 +94,11 @@ def NeverWhere(configfile=None):
def index():
return renderInitial()
@app.route("/blog/scripts/<filename>", methods=("GET", "POST"))
def send_script(filename):
print("matched scripts route")
return send_from_directory("/srv/http/riotblog/scripts", filename)
@app.route("/blog/styles/<filename>", methods=("GET", "POST"))
def send_style(filename):
return send_from_directory("/srv/http/riotblog/styles", filename)
# get the next post
@app.route("/blog/switchpost/<pid>/<category>")
def getpostid(pid, category):
return posts.iterpost(startkey=pid, category=category)
# get the first post
@app.route("/blog/switchpost/")
def nextpost():
return posts.iterpost()
# get the post previous to this one
@app.route("/blog/prevpost/<pid>/<category>")
def prevpost(pid, category):

Loading…
Cancel
Save