summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/www/js/lib')
-rw-r--r--StoneIsland/www/js/lib/blogs/HubView.js20
-rw-r--r--StoneIsland/www/js/lib/products/GalleryView.js8
-rw-r--r--StoneIsland/www/js/lib/products/ProductView.js4
3 files changed, 16 insertions, 16 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(){
diff --git a/StoneIsland/www/js/lib/products/GalleryView.js b/StoneIsland/www/js/lib/products/GalleryView.js
index b36c5df2..02193f14 100644
--- a/StoneIsland/www/js/lib/products/GalleryView.js
+++ b/StoneIsland/www/js/lib/products/GalleryView.js
@@ -4,8 +4,8 @@ var GalleryView = View.extend({
template: $("#gallery .template").html(),
events: {
- "click .left": "prev",
- "click .right": "next",
+// "click .left": "prev",
+// "click .right": "next",
// "touchstart .gallery": "touchstart",
// "touchmove .gallery": "touchmove",
// "touchend .gallery": "touchend",
@@ -51,10 +51,6 @@ var GalleryView = View.extend({
})
},
- prev: function(){
- },
- next: function(){
- },
touchstart: function(e){
},
touchmove: function(e){
diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js
index 5b7ee6d2..4789850a 100644
--- a/StoneIsland/www/js/lib/products/ProductView.js
+++ b/StoneIsland/www/js/lib/products/ProductView.js
@@ -47,10 +47,10 @@ var ProductView = ScrollableView.extend({
cache: {},
gallery_prev: function(){
- this.gallery.gallery.flickity('prev')
+ app.product.gallery.gallery.previous()
},
gallery_right: function(){
- this.gallery.gallery.flickity('next')
+ app.product.gallery.gallery.next()
},
find: function(code, cb){