Fix #1267 List is not renumbered after delete & Fix #1264 Can not add field, if there is no field in database

This commit is contained in:
Nicolas Le Goff
2013-07-10 19:24:19 +02:00
parent 14949cb619
commit 68ebcfddb5
8 changed files with 73 additions and 50 deletions

View File

@@ -183,23 +183,10 @@ define([
modalView.render();
modalView.on("modal:confirm", function() {
self.model.destroy({
success: function(model, response) {
AdminFieldApp.fieldListView.collection.remove(self.model);
self._selectModelView(index);
new AlertView({alert: "info", message: i18n.t("deleted_success", {
postProcess: "sprintf",
sprintf: [model.get("name")]
})
}).render();
},
error: function(xhr, textStatus, errorThrown) {
new AlertView({
alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
}).render();
}
});
AdminFieldApp.fieldsToDelete.push(self.model);
AdminFieldApp.fieldListView.collection.remove(self.model);
self._selectModelView(index);
AdminFieldApp.saveView.updateStateButton();
});
return this;