diff options
Diffstat (limited to 'StoneIsland/www/js/lib/blogs/StoryView.js')
| -rw-r--r-- | StoneIsland/www/js/lib/blogs/StoryView.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/StoneIsland/www/js/lib/blogs/StoryView.js b/StoneIsland/www/js/lib/blogs/StoryView.js index 70ac061f..84684ff7 100644 --- a/StoneIsland/www/js/lib/blogs/StoryView.js +++ b/StoneIsland/www/js/lib/blogs/StoryView.js @@ -1,5 +1,7 @@ var StoryView = ScrollableView.extend({ + loaded: false, + el: "#story", template: $("#story .template").html(), @@ -23,19 +25,19 @@ var StoryView = ScrollableView.extend({ }, populate: function(data){ + if (this.loaded) { console.warn("populate called twice"); return } + this.loaded = true this.data = data this.$loader.hide() this.$content.empty() // id title image[uri caption] body this.data.forEach(function(row){ var t = this.template.replace(/{{id}}/, row.id) - .replace(/{{title}}/, row.title) .replace(/{{body}}/, row.body.replace(/\n/g, "<br>")) var li = document.createElement("li") li.dataset.id = row.id li.innerHTML = row.title this.sections[row.id] = row - //console.log("ok"); this.$links.append(li) this.$content.append(t) }.bind(this)) |
