summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/blogs/HubView.js
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib/blogs/HubView.js')
-rw-r--r--StoneIsland/www/js/lib/blogs/HubView.js20
1 files changed, 12 insertions, 8 deletions
diff --git a/StoneIsland/www/js/lib/blogs/HubView.js b/StoneIsland/www/js/lib/blogs/HubView.js
index 001b8161..87f8127e 100644
--- a/StoneIsland/www/js/lib/blogs/HubView.js
+++ b/StoneIsland/www/js/lib/blogs/HubView.js
@@ -22,14 +22,16 @@ var HubView = ScrollableView.extend({
document.body.className = "hub"
},
+ galleries: {},
populate: function(data){
this.data = data
this.$loader.hide()
this.$content.empty()
+ this.galleries = {}
// id date subtitle body link store image[uri caption]
this.data.forEach(function(row){
// console.log(row)
- var t = this.template.replace(/{{id}}/, row.id)
+ var t = this.template.replace(/{{id}}/g, row.id)
.replace(/{{date}}/, moment(row.date).format("MM.DD.YYYY"))
.replace(/{{title}}/, row.title)
.replace(/{{subtitle}}/, row.subtitle)
@@ -50,7 +52,7 @@ var HubView = ScrollableView.extend({
el.className = "item"
$gallery.append(el)
})
- new Flickity( ".gallery-" + row.id, {
+ this.galleries[row.id] = new Flickity( ".gallery-" + row.id, {
selector: '.item',
cellAlign: 'center',
autoPlay: false,
@@ -76,8 +78,8 @@ var HubView = ScrollableView.extend({
play.className = "play"
$(".gallery-" + row.id).append(play)
}
- $t.find("gallery-left").remove()
- $t.find("gallery-right").remove()
+ $t.find(".gallery-left").remove()
+ $t.find(".gallery-right").remove()
}
}.bind(this))
@@ -89,11 +91,13 @@ var HubView = ScrollableView.extend({
app.router.go("store")
},
- gallery_prev: function(e){
- $(e.currentTarget).closest("hub_item").flickity('prev')
+ gallery_left: function(e){
+ var id = $(e.currentTarget).closest(".hub_item").data('id')
+ this.galleries[id].previous()
},
- gallery_next: function(e){
- $(e.currentTarget).closest("hub_item").flickity('next')
+ gallery_right: function(e){
+ var id = $(e.currentTarget).closest(".hub_item").data('id')
+ this.galleries[id].next()
},
share: function(){