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