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',
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({

View file

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