mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-10 07:16:08 +01:00
Fix #304, saving array fields
This commit is contained in:
@@ -98,12 +98,20 @@
|
||||
|
||||
ArrayField.prototype.remove = function(event) {
|
||||
var row = $(event.target).closest('[data-grav-array-type="row"]');
|
||||
var lastItem = false;
|
||||
|
||||
if (row.siblings().length == 0) {
|
||||
//on the last item we just clear its values
|
||||
row.find('input').val('');
|
||||
return;
|
||||
lastItem = true;
|
||||
this.add(event);
|
||||
}
|
||||
|
||||
row.remove();
|
||||
|
||||
if (lastItem == true) {
|
||||
this.refreshAll();
|
||||
}
|
||||
|
||||
if (this.isValueOnly()) {
|
||||
this.refreshAll();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@
|
||||
</div>
|
||||
{% else %}
|
||||
{% if field.value_only != true %}
|
||||
{% if key == '0' and text == '' %}
|
||||
{% set key = '' %}
|
||||
{% endif %}
|
||||
|
||||
<input data-grav-array-type="key" type="text" value="{{ key }}" placeholder="{{ field.placeholder_key|e|tu }}" />
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user