diff options
| author | Jules Laplace <jules@okfoc.us> | 2017-05-11 02:58:40 +0200 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2017-05-11 02:58:40 +0200 |
| commit | 8003f1dc9e7ab23493b26eefbfd6cda314268264 (patch) | |
| tree | e90afd92059216c15d0459bd2fbaadce72e6d3b8 /public/assets/js/lib/view | |
init
Diffstat (limited to 'public/assets/js/lib/view')
| -rw-r--r-- | public/assets/js/lib/view/HomeView.js | 27 | ||||
| -rw-r--r-- | public/assets/js/lib/view/ListView.js | 37 | ||||
| -rw-r--r-- | public/assets/js/lib/view/PageView.js | 43 | ||||
| -rw-r--r-- | public/assets/js/lib/view/PaintingView.js | 36 |
4 files changed, 143 insertions, 0 deletions
diff --git a/public/assets/js/lib/view/HomeView.js b/public/assets/js/lib/view/HomeView.js new file mode 100644 index 0000000..3eac71e --- /dev/null +++ b/public/assets/js/lib/view/HomeView.js @@ -0,0 +1,27 @@ +var HomeView = View.extend({ + + el: "#home", + + // template: liquid($('#tmpl-home').html()), + + events: { + }, + + initialize: function(options){ + options = options || {} + var data = this.data = options.data + }, + + render: function(){ + if (this.rendered) return + this.rendered = true + }, + + show: function(){ + this.render(this.data) + }, + + hide: function(){ + }, + +}) diff --git a/public/assets/js/lib/view/ListView.js b/public/assets/js/lib/view/ListView.js new file mode 100644 index 0000000..5161a31 --- /dev/null +++ b/public/assets/js/lib/view/ListView.js @@ -0,0 +1,37 @@ +var ListView = View.extend({ + + el: "#list", + + events: { + "click div": "load", + }, + + initialize: function(options){ + options = options || {} + var data = this.data = options.data + }, + + render: function(){ + if (this.rendered) return + this.rendered = true + }, + + show: function(){ + this.render(this.data) + document.body.className = "listopen" + }, + + hide: function(){ + document.body.className = "" + $(".visible").removeClass("visible") + $("#nav a.active").removeClass('active') + }, + + load: function(e){ + var index = $(e.currentTarget).data("index") + $.fn.fullpage.moveTo(index+1) + console.log(index) + this.hide() + }, + +}) diff --git a/public/assets/js/lib/view/PageView.js b/public/assets/js/lib/view/PageView.js new file mode 100644 index 0000000..10f18d6 --- /dev/null +++ b/public/assets/js/lib/view/PageView.js @@ -0,0 +1,43 @@ +var PageView = View.extend({ + + el: "body", + + events: { + "click #close": "close", + }, + + initialize: function(options){ + options = options || {} + var data = this.data = options.data + }, + + render: function(){ + if (this.rendered) return + this.rendered = true + }, + + show: function(){ + this.render(this.data) + document.body.className = "pageopen" + MAKE_CONFETTI() + confetti_on = true + }, + + hide: function(){ + document.body.className = "" + confetti_on = false + $(".visible").removeClass("visible") + $("#nav a.active").removeClass('active') + }, + + close: function(){ + app.router.go("/") + }, + + load: function(id){ + $("#nav a[href='/page/" + id + "']").addClass('active') + this.$("#" + id).addClass("visible") + }, + + +}) diff --git a/public/assets/js/lib/view/PaintingView.js b/public/assets/js/lib/view/PaintingView.js new file mode 100644 index 0000000..5c4f3bd --- /dev/null +++ b/public/assets/js/lib/view/PaintingView.js @@ -0,0 +1,36 @@ +var PaintingView = View.extend({ + + el: "body", + + // template: liquid($('#tmpl-about').html()), + + events: { + }, + + initialize: function(options){ + options = options || {} + var data = this.data = options.data + }, + + render: function(){ + if (this.rendered) return + this.rendered = true + }, + + show: function(){ + this.render(this.data) + document.body.className = "painting" + }, + + hide: function(){ + // document.body.className = "about" + }, + + load: function(id){ + var index = this.data.paintings.map(function(p){ return p.id }).indexOf(id) + if (index) { + $.fn.fullpage.moveTo(index+1) + } + }, + +}) |
