-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add confirmation before deletion (#289)
Prompt user for confirmation before deleting storage service or fetch job.
- Loading branch information
Showing
4 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends "base.html" %} | ||
|
||
{% block content %} | ||
<form method="GET" action="{{ request.url }}"> | ||
<input type="hidden" name="confirm" value="1" /> | ||
<input type="submit" value="{{ action }}" class='btn btn-danger' /> <a href="{{ url_for(cancel_route) }}" class='btn btn-default'>Cancel</a> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from functools import wraps | ||
|
||
from flask import render_template, request | ||
|
||
|
||
def confirm_required(action, cancel_route): | ||
def decorator(f): | ||
@wraps(f) | ||
def decorated_function(*args, **kwargs): | ||
if request.args.get("confirm"): | ||
return f(*args, **kwargs) | ||
|
||
return render_template( | ||
"confirm.html", | ||
action=action, | ||
cancel_route=cancel_route, | ||
) | ||
|
||
return decorated_function | ||
|
||
return decorator |