fix multiview for just one view, god hope that bug isnt in production

This commit is contained in:
Peter Cottle 2015-04-20 14:05:28 +10:00
parent 48c418072e
commit e54d65f927
2 changed files with 39 additions and 32 deletions

View file

@ -148,26 +148,6 @@ var LeftRightView = PositiveNegativeBase.extend({
tagName: 'div', tagName: 'div',
className: 'leftRightView box horizontal center', className: 'leftRightView box horizontal center',
template: _.template($('#left-right-template').html()), 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) { initialize: function(options) {
if (!options.destination || !options.events) { if (!options.destination || !options.events) {
@ -188,7 +168,28 @@ var LeftRightView = PositiveNegativeBase.extend({
}; };
this.render(); 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({ var ModalView = Backbone.View.extend({

View file

@ -408,6 +408,11 @@
</script> </script>
<script type="text/html" id="left-right-template"> <script type="text/html" id="left-right-template">
<% if (!showLeft && lastNav ) { %>
<div class="box right">
<i class="icon-ok exit"></i>
</div>
<% } else { %>
<% if (showLeft) { %> <% if (showLeft) { %>
<div class="box left"> <div class="box left">
<i class="icon-circle-arrow-left"></i> <i class="icon-circle-arrow-left"></i>
@ -423,6 +428,7 @@
<i class="icon-ok"></i> <i class="icon-ok"></i>
<% } %> <% } %>
</div> </div>
<% } %>
</script> </script>
<script type="text/html" id="confirm-cancel-template"> <script type="text/html" id="confirm-cancel-template">