Browse Source

make sure initial post is using the hardcoded one

pull/1/head
wes 7 years ago
parent
commit
119bc4c1ae
  1. 5
      src/scripts/app.tag
  2. 6
      src/scripts/post.tag
  3. 1
      src/templates/index.html
  4. 1
      src/website.py

5
src/scripts/app.tag

@ -130,6 +130,7 @@ document.addEventListener("click", function(event) {
});
self.state = {
"browsed" : false, /* was a link clicked to a post yet */
"page" : self.opts.page,
"results" : self.decode(self.opts.results),
"start" : self.opts.start,
@ -141,7 +142,8 @@ self.state = {
"loaded" : false,
"initial" : document.getElementsByTagName("noscript")[0].textContent,
"links" : self.decode(self.opts.links),
"categories" : self.decode(self.opts.categories)
"categories" : self.decode(self.opts.categories),
"post_categories" : self.decode(self.opts.post_categories)
};
self.active = lens.actives({
@ -215,6 +217,7 @@ self.on("mount", () => {
window.RiotControl.on("openpost",
(id) => {
console.log("caught the event in the app tag");
self.state.browsed = true;
console.log(`the id is ${id}`);
self.route(`/posts/${id}`);
}

6
src/scripts/post.tag

@ -57,7 +57,7 @@ self.route = route;
self.loading = false;
self.categories = [];
self.categories = self.opts.state.post_categories;
self._id = self.opts.state._id.slice(-hashLength);
self.author = self.opts.state.author;
self.title = self.opts.state.title;
@ -181,7 +181,9 @@ prevPost(_id) {
}
self.on("mount", () => {
self.getPost(self._id);
if (self.opts.state.browsed) {
self.getPost(self._id);
}
});
</script>

1
src/templates/index.html

@ -27,6 +27,7 @@
start: "{{ start }}",
results: "{{ quote(results) }}",
categories: "{{ quote(categories) }}",
post_categories: "{{ quote(dumps(postcontent['categories'])) }}",
links : "{{ quote(links) }}",
page : "{{ page }}",
author : "{{ postcontent['author'] }}",

1
src/website.py

@ -69,6 +69,7 @@ def NeverWhere(configfile=None):
postcontent["title"] = initial_post["title"]
return {
"quote" : quote,
"dumps" : dumps,
"start" : 0,
"results" : dumps([]),
"postid" : initial_post["_id"],

Loading…
Cancel
Save