summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/www/js/lib/blogs/StoryView.js
blob: 0f03a518ff4dc6d5edba220405f58f72f9b8ab0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var StoryView = View.extend({
  
  el: "#story",
  template: $("#story .template").html(),

  events: {
  },
  
  initialize: function(){
    this.$content = this.$(".content")
    this.$loader = this.$(".loader")
    this.scroller = new IScroll('#story .scroll')
  },

  show: function(){
    document.body.className = "story"
  },
  
  populate: function(data){
    this.data = data
    this.$loader.hide()
    this.$content.empty()
    this.data.forEach(function(row){
      var t = this.template.replace({{image}}, row.image.url)
                           .replace({{date}}, row.date)
                           .replace({{title}}, row.title)
                           .replace({{body}}, row.body)
      this.$content.append(t)
    }.bind(this))
  },

})