Should not be able to delete last empty array field. Fixes #145

This commit is contained in:
Flavio Copes
2015-09-07 10:27:17 +02:00
parent 47f6eb49a1
commit 921fb71dbc

View File

@@ -93,6 +93,10 @@
}; };
ArrayField.prototype.remove = function(event) { ArrayField.prototype.remove = function(event) {
if ($(event.target).closest('[data-grav-array-type="row"]').siblings().length == 0) {
//disable for the last item
return;
}
$(event.target).closest('[data-grav-array-type="row"]').remove(); $(event.target).closest('[data-grav-array-type="row"]').remove();
if (this.isValueOnly()) { if (this.isValueOnly()) {
this.refreshAll(); this.refreshAll();