From e54d65f92743a99f1a451d8be3eba5d40b46cc1b Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Mon, 20 Apr 2015 14:05:28 +1000 Subject: [PATCH] fix multiview for just one view, god hope that bug isnt in production --- src/js/views/index.js | 41 +++++++++++++++++++++-------------------- src/template.index.html | 30 ++++++++++++++++++------------ 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/js/views/index.js b/src/js/views/index.js index 4c050dd3..1a693ab6 100644 --- a/src/js/views/index.js +++ b/src/js/views/index.js @@ -148,26 +148,6 @@ var LeftRightView = PositiveNegativeBase.extend({ tagName: 'div', className: 'leftRightView box horizontal center', template: _.template($('#left-right-template').html()), - events: { - 'click .left': 'negative', - 'click .exit': 'exit', - 'click .right': 'positive' - }, - - exit: function() { - this.pipeEvents.trigger('exit'); - LeftRightView.__super__.exit.apply(this); - }, - - positive: function() { - this.pipeEvents.trigger('positive'); - LeftRightView.__super__.positive.apply(this); - }, - - negative: function() { - this.pipeEvents.trigger('negative'); - LeftRightView.__super__.negative.apply(this); - }, initialize: function(options) { if (!options.destination || !options.events) { @@ -188,7 +168,28 @@ var LeftRightView = PositiveNegativeBase.extend({ }; this.render(); + // For some weird reason backbone events arent working anymore so + // im going to just wire this up manually + this.$('div.right').click(this.positive.bind(this)); + this.$('div.left').click(this.negative.bind(this)); + this.$('div.exit').click(this.exit.bind(this)); + }, + + exit: function() { + this.pipeEvents.trigger('exit'); + LeftRightView.__super__.exit.apply(this); + }, + + positive: function() { + this.pipeEvents.trigger('positive'); + LeftRightView.__super__.positive.apply(this); + }, + + negative: function() { + this.pipeEvents.trigger('negative'); + LeftRightView.__super__.negative.apply(this); } + }); var ModalView = Backbone.View.extend({ diff --git a/src/template.index.html b/src/template.index.html index 934b4e3f..0344c201 100644 --- a/src/template.index.html +++ b/src/template.index.html @@ -408,21 +408,27 @@