From c242cbaf23c0b0f3398bfa1e8f95ab4bf4294b2a Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 25 Nov 2015 05:04:15 -0500 Subject: vv basic archive ui --- StoneIsland/www/index.html | 88 +++++++++++++++++++++++++---- StoneIsland/www/js/lib/blogs/ArchiveView.js | 37 ++++++++++-- 2 files changed, 109 insertions(+), 16 deletions(-) (limited to 'StoneIsland/www') diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 84e21692..d3e182ea 100644 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -160,26 +160,94 @@
+
-

ARCHIVE

-
'982-'015
+ +
+

ARCHIVE

+
'982-'015
+
diff --git a/StoneIsland/www/js/lib/blogs/ArchiveView.js b/StoneIsland/www/js/lib/blogs/ArchiveView.js index 051ef0c9..3ba1dfb2 100644 --- a/StoneIsland/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/www/js/lib/blogs/ArchiveView.js @@ -1,20 +1,34 @@ var ArchiveView = ScrollableView.extend({ el: "#archive", - template: $("#archive .template").html(), + menu_template: $("#archive .menu .template").html(), + row_template: $("#archive .scroll .template").html(), events: { + "click .item": "pick", }, initialize: function(){ + this.$menu_items = this.$(".menu .items") this.$content = this.$(".content") this.$loader = this.$(".loader") - this.scroller = new IScroll('#archive', app.iscroll_options) + this.scroller = new IScroll('#archive .scroll', app.iscroll_options) }, + back: function(){ + this.$el.addClass("menu") + app.header.set_back(false) + }, + + pick: function(){ + this.$el.removeClass("menu") + app.header.set_back(true) + }, + show: function(){ this.deferScrollToTop() app.footer.hide() + this.back() document.body.className = "archive" }, @@ -24,12 +38,23 @@ var ArchiveView = ScrollableView.extend({ this.$content.empty() // id title images[ uri label code caption ] - this.data.forEach(function(row){ - var t = this.template.replace(/{{image}}/, row.images[0].uri) - .replace(/{{code}}/, row.code) - .replace(/{{title}}/, row.title) + this.data.forEach(function(row, index){ + var t = this.row_template.replace(/{{image}}/, row.images[0].uri) + .replace(/{{label}}/, row.images[0].label) + .replace(/{{code}}/, row.images[0].code) + .replace(/{{caption}}/, row.images[0].caption) this.$content.append(t) + + var t = this.menu_template.replace(/{{title}}/, row.title) + var $t = $(t) + $t.data("title", row.title) + $t.data("index", index) + this.$menu_items.append($t) }.bind(this)) + + + this.back() + this.deferScrollToTop() }, }) \ No newline at end of file -- cgit v1.2.3-70-g09d2