Commit 042aaf94 by Christina Roberts

Merge pull request #1030 from edx/christina/textbook-cleanup

Minor cleanup.
parents 3717df20 e65e9b53
...@@ -25,7 +25,7 @@ describe "CMS.Models.Textbook", -> ...@@ -25,7 +25,7 @@ describe "CMS.Models.Textbook", ->
expect(@model.isEmpty()).toBeTruthy() expect(@model.isEmpty()).toBeTruthy()
it "should have a URL set", -> it "should have a URL set", ->
expect(_.result(@model, "url")).toBeTruthy() expect(@model.url()).toBeTruthy()
it "should be able to reset itself", -> it "should be able to reset itself", ->
@model.set("name", "foobar") @model.set("name", "foobar")
...@@ -124,14 +124,14 @@ describe "CMS.Models.Textbook", -> ...@@ -124,14 +124,14 @@ describe "CMS.Models.Textbook", ->
describe "CMS.Collections.TextbookSet", -> describe "CMS.Collections.TextbookSet", ->
beforeEach -> beforeEach ->
CMS.URL.TEXTBOOK = "/textbooks" CMS.URL.TEXTBOOKS = "/textbooks"
@collection = new CMS.Collections.TextbookSet() @collection = new CMS.Collections.TextbookSet()
afterEach -> afterEach ->
delete CMS.URL.TEXTBOOK delete CMS.URL.TEXTBOOKS
it "should have a url set", -> it "should have a url set", ->
expect(_.result(@collection, "url"), "/textbooks") expect(@collection.url()).toEqual("/textbooks")
it "can call save", -> it "can call save", ->
spyOn(@collection, "sync") spyOn(@collection, "sync")
......
...@@ -156,7 +156,6 @@ CMS.Views.ListTextbooks = Backbone.View.extend({ ...@@ -156,7 +156,6 @@ CMS.Views.ListTextbooks = Backbone.View.extend({
initialize: function() { initialize: function() {
this.emptyTemplate = _.template($("#no-textbooks-tpl").text()); this.emptyTemplate = _.template($("#no-textbooks-tpl").text());
this.listenTo(this.collection, 'all', this.render); this.listenTo(this.collection, 'all', this.render);
this.listenTo(this.collection, 'destroy', this.handleDestroy);
}, },
tagName: "div", tagName: "div",
className: "textbooks-list", className: "textbooks-list",
...@@ -185,9 +184,6 @@ CMS.Views.ListTextbooks = Backbone.View.extend({ ...@@ -185,9 +184,6 @@ CMS.Views.ListTextbooks = Backbone.View.extend({
addOne: function(e) { addOne: function(e) {
if(e && e.preventDefault) { e.preventDefault(); } if(e && e.preventDefault) { e.preventDefault(); }
this.collection.add([{editing: true}]); this.collection.add([{editing: true}]);
},
handleDestroy: function(model, collection, options) {
collection.remove(model);
} }
}); });
CMS.Views.EditChapter = Backbone.View.extend({ CMS.Views.EditChapter = Backbone.View.extend({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment