mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
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:
@@ -37,24 +37,41 @@ define([
|
||||
|
||||
if (this._isModelDesync()) {
|
||||
this._loadingState(true);
|
||||
AdminFieldApp.fieldsCollection.save({
|
||||
success: function(fields) {
|
||||
// reset collection with new one
|
||||
AdminFieldApp.fieldsCollection.reset(fields);
|
||||
$.when.apply($, _.map(AdminFieldApp.fieldsToDelete, function(m){
|
||||
return m.destroy({
|
||||
success: function(model, response) {
|
||||
AdminFieldApp.fieldsToDelete = _.filter(AdminFieldApp.fieldsToDelete, function(m){
|
||||
return model.get("id") !== m.get("id");
|
||||
});
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
new AlertView({
|
||||
alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
|
||||
}).render();
|
||||
}
|
||||
});
|
||||
})).done(
|
||||
function() {
|
||||
AdminFieldApp.fieldsCollection.save({
|
||||
success: function(fields) {
|
||||
// reset collection with new one
|
||||
AdminFieldApp.fieldsCollection.reset(fields);
|
||||
|
||||
new AlertView({
|
||||
alert: "success",
|
||||
message: i18n.t("fields_save")
|
||||
}).render();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
new AlertView({
|
||||
alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
|
||||
}).render();
|
||||
new AlertView({
|
||||
alert: "success",
|
||||
message: i18n.t("fields_save")
|
||||
}).render();
|
||||
},
|
||||
error: function(xhr, textStatus, errorThrown) {
|
||||
new AlertView({
|
||||
alert: "error", message: '' !== xhr.responseText ? xhr.responseText : i18n.t("something_wrong")
|
||||
}).render();
|
||||
}
|
||||
}).done(function() {
|
||||
self._loadingState(false);
|
||||
});
|
||||
}
|
||||
}).done(function() {
|
||||
self._loadingState(false);
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
Reference in New Issue
Block a user