BOOYAH BABY FIRST BACKBONE VIEW REMOVED REACT FTW

This commit is contained in:
Peter Cottle 2015-04-11 12:02:20 -07:00
parent a7b23e0342
commit d4e0887bc7
7 changed files with 128 additions and 184 deletions

View file

@ -201,20 +201,13 @@ var Command = Backbone.Model.extend({
},
addWarning: function(msg) {
console.log('this is the warning', msg);
this.get('warnings').push(msg);
// change numWarnings so the change event fires. This is bizarre -- Backbone can't
// detect if an array changes, so adding an element does nothing
this.set('numWarnings', this.get('numWarnings') ? this.get('numWarnings') + 1 : 1);
},
getFormattedWarnings: function() {
if (!this.get('warnings').length) {
return '';
}
var i = '<i class="icon-exclamation-sign"></i>';
return '<p>' + i + this.get('warnings').join('</p><p>' + i) + '</p>';
},
parseOrCatch: function() {
this.expandShortcuts(this.get('rawStr'));
try {
@ -253,7 +246,7 @@ var Command = Backbone.Model.extend({
},
formatError: function() {
this.set('result', this.get('error').toResult());
this.set('result', this.get('error').getMsg());
},
expandShortcuts: function(str) {