summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/view/PageView.js
blob: 10f18d6f3fa936d54b2d4a584a942d584b084e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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")
  },


})