Can't add new textbook if the currently-editing textbook is empty

This commit is contained in:
David Baumgold
2013-06-12 11:04:51 -04:00
parent c0b00f7dd5
commit 9de2dc51ec

View File

@@ -250,6 +250,8 @@ CMS.Views.ListTextbooks = Backbone.View.extend({
},
addOne: function(e) {
if(e && e.preventDefault) { e.preventDefault(); }
// if the existing edited textbook is empty, don't do anything
if(this.collection.editing && this.collection.editing.isEmpty()) { return; }
var m = new this.collection.model;
this.collection.add(m);
this.collection.trigger("editOne", m);