Fix #1623 Can not display empty admin fields list

This commit is contained in:
Nicolas Le Goff
2013-12-16 14:10:03 +01:00
parent 816a53a54e
commit 060d6d9fdb
3 changed files with 20 additions and 5 deletions

View File

@@ -85,14 +85,25 @@ define([
return this;
},
updateStateButton: function (disable) {
var toDisable = disable || !this._isModelDesync();
var toDisable = !this._isModelDesync();
if ("undefined" !== typeof disable) {
toDisable = disable;
}
this._disableSaveButton(toDisable);
},
// check whether model has changed or not
_isModelDesync: function () {
return "undefined" !== typeof AdminFieldApp.fieldsCollection.find(function (model) {
var fieldToDelete = false;
var fieldToUpdate = false;
fieldToUpdate = "undefined" !== typeof AdminFieldApp.fieldsCollection.find(function (model) {
return !_.isEmpty(model.previousAttributes());
});
fieldToDelete = AdminFieldApp.fieldsToDelete.length > 0;
return fieldToUpdate || fieldToDelete;
},
// create a transparent overlay on top of the application
_overlay: function (showOrHide) {