editor: fix deleting mapitems
This commit is contained in:
parent
b309b6f6cd
commit
24611c8863
2 changed files with 11 additions and 6 deletions
|
@ -384,20 +384,25 @@ editor = {
|
||||||
_sidebar_submit_btn_click: function() {
|
_sidebar_submit_btn_click: function() {
|
||||||
// listener for submit-button-clicks in the sidebar, so the submit event will know which button submitted.
|
// listener for submit-button-clicks in the sidebar, so the submit event will know which button submitted.
|
||||||
$(this).closest('form').data('btn', $(this)).clearQueue().delay(300).queue(function() {
|
$(this).closest('form').data('btn', $(this)).clearQueue().delay(300).queue(function() {
|
||||||
$(this).data('button', null);
|
$(this).data('btn', null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_sidebar_submit: function(e) {
|
_sidebar_submit: function(e) {
|
||||||
// listener for form submits in the sidebar.
|
// listener for form submits in the sidebar.
|
||||||
if ($(this).attr('name') == 'redirect') return;
|
if ($(this).attr('name') == 'redirect') return;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
editor._sidebar_unload();
|
|
||||||
var data = $(this).serialize();
|
var data = $(this).serialize();
|
||||||
var btn = $(this).data('btn');
|
var btn = $(this).data('btn');
|
||||||
if (btn !== undefined && btn !== null && $(btn).is('[name]')) {
|
if (btn !== undefined && btn !== null) {
|
||||||
data += '&'+$('<input>').attr('name', $(btn).attr('name')).val($(btn).val()).serialize();
|
if ($(btn).is('[name]')) {
|
||||||
|
data += '&' + $('<input>').attr('name', $(btn).attr('name')).val($(btn).val()).serialize();
|
||||||
|
}
|
||||||
|
if ($(btn).is('[data-reload-geometries]')) {
|
||||||
|
editor._get_geometries_next_time = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var action = $(this).attr('action');
|
var action = $(this).attr('action');
|
||||||
|
editor._sidebar_unload();
|
||||||
$.post(action, data, editor._sidebar_loaded);
|
$.post(action, data, editor._sidebar_loaded);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
<input type="hidden" name="delete" value="1">
|
<input type="hidden" name="delete" value="1">
|
||||||
<input type="hidden" name="name" value="{{ name }}">
|
<input type="hidden" name="name" value="{{ name }}">
|
||||||
{% buttons %}
|
{% buttons %}
|
||||||
<a class="btn btn-default" href="{% url 'editor.mapitems' mapitem_type=mapitem_type level='LEVEL' %}" data-insert-level>
|
<a class="btn btn-default" href="{% url 'editor.mapitems.level' mapitem_type=mapitem_type level='LEVEL' %}" data-insert-level>
|
||||||
Cancel
|
Cancel
|
||||||
</a>
|
</a>
|
||||||
<button type="submit" name="delete_confirm" value="1" class="btn btn-danger pull-right">
|
<button type="submit" name="delete_confirm" value="1" class="btn btn-danger pull-right" data-reload-geometries>
|
||||||
Delete
|
Delete
|
||||||
</button>
|
</button>
|
||||||
{% endbuttons %}
|
{% endbuttons %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue