Commit c0b00f7d by David Baumgold

persist textbook deletions to the server

parent 486baced
......@@ -75,7 +75,7 @@ CMS.Views.TextbookShow = Backbone.View.extend({
tagName: "li",
events: {
"click .edit": "editTextbook",
"click .delete": "removeSelf",
"click .delete": "delete",
"click .show-chapters": "showChapters",
"click .hide-chapters": "hideChapters"
},
......@@ -87,9 +87,24 @@ CMS.Views.TextbookShow = Backbone.View.extend({
if(e && e.preventDefault) { e.preventDefault(); }
this.model.collection.trigger("editOne", this.model);
},
removeSelf: function(e) {
delete: function(e) {
if(e && e.preventDefault) { e.preventDefault(); }
this.model.collection.remove(this.model);
var collection = this.model.collection;
collection.remove(this.model);
msg = new CMS.Models.SystemFeedback({
intent: "saving",
title: gettext("Deleting…")
});
notif = new CMS.Views.Notification({
model: msg,
closeIcon: false,
minShown: 1250
});
collection.save({
complete: function() {
notif.hide();
}
});
},
showChapters: function(e) {
if(e && e.preventDefault) { e.preventDefault(); }
......
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