diff options
| author | Rene Ae <aehtyb@gmail.com> | 2015-11-30 15:24:27 -0600 |
|---|---|---|
| committer | Rene Ae <aehtyb@gmail.com> | 2015-11-30 15:24:27 -0600 |
| commit | 9d0e54228c79d151c30c527ea83efa7479793686 (patch) | |
| tree | 3baf83427cd61cb1994e8551eefba5cd21d1a65b /StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js | |
| parent | b208cb0283c23d68e8013c0dd5ddd4e5e6df8950 (diff) | |
| parent | d26e72aea3b3127c95c5ba7069c95f73cf52a2fd (diff) | |
Merge branch 'master' of https://github.com/okfocus/stone-island
Diffstat (limited to 'StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js')
| -rw-r--r-- | StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js b/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js index 051ef0c9..3db5c8da 100644 --- a/StoneIsland/platforms/ios/www/js/lib/blogs/ArchiveView.js +++ b/StoneIsland/platforms/ios/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,22 @@ 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 |
