diff --git a/dirkules/samba/templates/samba/remove.html b/dirkules/samba/templates/samba/remove.html index bf010e9..170fd99 100644 --- a/dirkules/samba/templates/samba/remove.html +++ b/dirkules/samba/templates/samba/remove.html @@ -2,6 +2,18 @@ {% block title %}Freigabe entfernen{% endblock %} {% block head %} {{ super() }} + {% if show_modal %} + + {% endif %} {% endblock %} {% block body %}
@@ -23,8 +35,25 @@ {% endif %} {{ form.hidden_tag() }} {{ render_field(form.remove_data) }} - {{ render_field(form.okay) }} + {{ render_field(form.submit) }} {% endblock %} + diff --git a/dirkules/samba/views.py b/dirkules/samba/views.py index 7ccf6f6..197f8cf 100644 --- a/dirkules/samba/views.py +++ b/dirkules/samba/views.py @@ -76,6 +76,7 @@ def generate(): @bp_samba.route('/remove', methods=['GET', 'POST']) def remove(): share_id = request.args.get('share') + show_modal = False if share_id is None: flash("Can't remove drive without id.") return redirect(url_for('.index')) @@ -84,10 +85,14 @@ def remove(): form = SambaRemovalForm(request.form) share_id = int(share_id) share = smb_man.get_share_by_id(share_id) - if request.method == 'POST' and form.validate(): - print("LOL") - return redirect(url_for('.index')) - return render_template('samba/remove.html', name=share.name, form=form) + if request.method == 'POST': + if form.validate(): + print("Alles Easy") + return redirect(url_for('.index')) + else: + show_modal = True + print(form.okay.data) + return render_template('samba/remove.html', name=share.name, form=form, show_modal=show_modal) except ValueError: flash("ValueError: id is not an int") except LookupError: