add can_close_modal so close-modal-now is only used it its possible

This commit is contained in:
Laura Klünder 2017-07-25 10:24:08 +02:00
parent eda5099190
commit 81da069942
3 changed files with 7 additions and 1 deletions

View file

@ -223,6 +223,7 @@ editor = {
}
var action = $(this).attr('action');
editor._sidebar_unload();
data += '&can_close_modal=' + ((editor._last_non_modal_path === null) ? '0' : '1');
$.post(action, data, editor._sidebar_loaded).fail(editor._sidebar_error);
},

View file

@ -4,6 +4,10 @@
{% include 'editor/fragment_modal_close.html' %}
<h3 {% if closemodal %}data-close-modal-now{% endif %}>{% trans 'Graph Editing Settings' %}</h3>
{% if not closemodal %}
{% bootstrap_messages %}
{% endif %}
<form action="{{ request.path }}" method="post">
{% csrf_token %}
{% bootstrap_form form %}

View file

@ -386,7 +386,8 @@ def graph_editing_settings(request):
form = GraphEditorSettingsForm(data=request.POST)
if form.is_valid():
messages.success(request, _('Graph Editing Settings were successfully saved.'))
ctx['closemodal'] = True
if request.POST.get('can_close_modal') == '1':
ctx['closemodal'] = True
else:
form = GraphEditorSettingsForm()