got boudns working

This commit is contained in:
Peter Cottle 2012-12-24 12:42:39 -08:00
parent 7acde81510
commit d825573ef9
4 changed files with 60 additions and 19 deletions

View file

@ -13713,13 +13713,11 @@ var ConfirmCancelView = require('../views').ConfirmCancelView;
var LeftRightView = require('../views').LeftRightView; var LeftRightView = require('../views').LeftRightView;
var ModalAlert = require('../views').ModalAlert; var ModalAlert = require('../views').ModalAlert;
var NAV_EVENT_DELAY = 300;
var MultiView = Backbone.View.extend({ var MultiView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
className: 'multiView', className: 'multiView',
// ms to debounce the nav functions // ms to debounce the nav functions
navEventDelay: 1500, navEventDebounce: 150,
// a simple mapping of what childViews we support // a simple mapping of what childViews we support
typeToConstructor: { typeToConstructor: {
@ -13753,25 +13751,34 @@ var MultiView = Backbone.View.extend({
getPosFunc: function() { getPosFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navForward(); this.navForward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
getNegFunc: function() { getNegFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navBackward(); this.navBackward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
navForward: function() { navForward: function() {
if (this.currentIndex === this.childViews.length - 1) {
this.hideViewIndex(this.currentIndex);
this.finish();
return;
}
this.navIndexChange(1); this.navIndexChange(1);
}, },
navBackward: function() { navBackward: function() {
if (this.currentIndex === 0) {
return;
}
this.navIndexChange(-1); this.navIndexChange(-1);
}, },
navIndexChange: function(delta) { navIndexChange: function(delta) {
console.log('doing nav index change', delta);
this.hideViewIndex(this.currentIndex); this.hideViewIndex(this.currentIndex);
this.currentIndex += delta; this.currentIndex += delta;
this.showViewIndex(this.currentIndex); this.showViewIndex(this.currentIndex);
@ -13785,6 +13792,11 @@ var MultiView = Backbone.View.extend({
this.childViews[index].show(); this.childViews[index].show();
}, },
finish: function() {
// promise resolve??
console.log('promise resolve :D');
},
createChildView: function(viewJSON) { createChildView: function(viewJSON) {
var type = viewJSON.type; var type = viewJSON.type;
if (!this.typeToConstructor[type]) { if (!this.typeToConstructor[type]) {
@ -17026,13 +17038,11 @@ var ConfirmCancelView = require('../views').ConfirmCancelView;
var LeftRightView = require('../views').LeftRightView; var LeftRightView = require('../views').LeftRightView;
var ModalAlert = require('../views').ModalAlert; var ModalAlert = require('../views').ModalAlert;
var NAV_EVENT_DELAY = 300;
var MultiView = Backbone.View.extend({ var MultiView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
className: 'multiView', className: 'multiView',
// ms to debounce the nav functions // ms to debounce the nav functions
navEventDelay: 1500, navEventDebounce: 150,
// a simple mapping of what childViews we support // a simple mapping of what childViews we support
typeToConstructor: { typeToConstructor: {
@ -17066,25 +17076,34 @@ var MultiView = Backbone.View.extend({
getPosFunc: function() { getPosFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navForward(); this.navForward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
getNegFunc: function() { getNegFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navBackward(); this.navBackward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
navForward: function() { navForward: function() {
if (this.currentIndex === this.childViews.length - 1) {
this.hideViewIndex(this.currentIndex);
this.finish();
return;
}
this.navIndexChange(1); this.navIndexChange(1);
}, },
navBackward: function() { navBackward: function() {
if (this.currentIndex === 0) {
return;
}
this.navIndexChange(-1); this.navIndexChange(-1);
}, },
navIndexChange: function(delta) { navIndexChange: function(delta) {
console.log('doing nav index change', delta);
this.hideViewIndex(this.currentIndex); this.hideViewIndex(this.currentIndex);
this.currentIndex += delta; this.currentIndex += delta;
this.showViewIndex(this.currentIndex); this.showViewIndex(this.currentIndex);
@ -17098,6 +17117,11 @@ var MultiView = Backbone.View.extend({
this.childViews[index].show(); this.childViews[index].show();
}, },
finish: function() {
// promise resolve??
console.log('promise resolve :D');
},
createChildView: function(viewJSON) { createChildView: function(viewJSON) {
var type = viewJSON.type; var type = viewJSON.type;
if (!this.typeToConstructor[type]) { if (!this.typeToConstructor[type]) {

View file

@ -163,7 +163,7 @@
<% if (showLeft) { %> <% if (showLeft) { %>
<div class="box left"> <div class="box left">
<% } else { %> <% } else { %>
<div class="box left" style="opacity: 0; cursor: default"> <div class="box left hideLeft">
<% } %> <% } %>
<i class="icon-circle-arrow-left"></i> <i class="icon-circle-arrow-left"></i>
</div> </div>

View file

@ -10,13 +10,11 @@ var ConfirmCancelView = require('../views').ConfirmCancelView;
var LeftRightView = require('../views').LeftRightView; var LeftRightView = require('../views').LeftRightView;
var ModalAlert = require('../views').ModalAlert; var ModalAlert = require('../views').ModalAlert;
var NAV_EVENT_DELAY = 300;
var MultiView = Backbone.View.extend({ var MultiView = Backbone.View.extend({
tagName: 'div', tagName: 'div',
className: 'multiView', className: 'multiView',
// ms to debounce the nav functions // ms to debounce the nav functions
navEventDelay: 1500, navEventDebounce: 150,
// a simple mapping of what childViews we support // a simple mapping of what childViews we support
typeToConstructor: { typeToConstructor: {
@ -50,25 +48,34 @@ var MultiView = Backbone.View.extend({
getPosFunc: function() { getPosFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navForward(); this.navForward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
getNegFunc: function() { getNegFunc: function() {
return _.debounce(_.bind(function() { return _.debounce(_.bind(function() {
this.navBackward(); this.navBackward();
}, this), NAV_EVENT_DELAY, true); }, this), this.navEventDebounce, true);
}, },
navForward: function() { navForward: function() {
if (this.currentIndex === this.childViews.length - 1) {
this.hideViewIndex(this.currentIndex);
this.finish();
return;
}
this.navIndexChange(1); this.navIndexChange(1);
}, },
navBackward: function() { navBackward: function() {
if (this.currentIndex === 0) {
return;
}
this.navIndexChange(-1); this.navIndexChange(-1);
}, },
navIndexChange: function(delta) { navIndexChange: function(delta) {
console.log('doing nav index change', delta);
this.hideViewIndex(this.currentIndex); this.hideViewIndex(this.currentIndex);
this.currentIndex += delta; this.currentIndex += delta;
this.showViewIndex(this.currentIndex); this.showViewIndex(this.currentIndex);
@ -82,6 +89,11 @@ var MultiView = Backbone.View.extend({
this.childViews[index].show(); this.childViews[index].show();
}, },
finish: function() {
// promise resolve??
console.log('promise resolve :D');
},
createChildView: function(viewJSON) { createChildView: function(viewJSON) {
var type = viewJSON.type; var type = viewJSON.type;
if (!this.typeToConstructor[type]) { if (!this.typeToConstructor[type]) {

View file

@ -463,6 +463,11 @@ li.rebaseEntry.notPicked {
cursor: pointer; cursor: pointer;
} }
.leftRightView div.hideLeft i {
cursor: default;
opacity: 0;
}
.leftRightView div { .leftRightView div {
margin: 0 20px; margin: 0 20px;
} }