Mercurial > farol
changeset 99:0b9f19f51d79
Add deletion of the whole Product Tree
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 16:48:12 +0200 |
parents | 9b525f33080a |
children | 5535ac5fef37 |
files | farol/producttree.py farol/templates/producttree/view.j2 |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/producttree.py Thu Oct 09 16:43:22 2014 +0200 +++ b/farol/producttree.py Thu Oct 09 16:48:12 2014 +0200 @@ -59,6 +59,13 @@ return render_template('producttree/view.j2', producttree=cvrf._producttree, cvrf=cvrf) +@producttree.route('/delete', methods=['POST']) +@producttree_required +def delete(): + # XXX: We should first check if no PID and GID is used ... + get_current()._producttree = None + return redirect(url_for('document.view')) + @producttree.route('/branch/<path:path>/edit', methods=['GET', 'POST']) @document_required @producttree_required
--- a/farol/templates/producttree/view.j2 Thu Oct 09 16:43:22 2014 +0200 +++ b/farol/templates/producttree/view.j2 Thu Oct 09 16:48:12 2014 +0200 @@ -100,4 +100,5 @@ {% endfor %} <a href="{{ url_for('.add_group') }}" class="pull-right">add</a> {% endcall %} +<div class="pull-right">{{ delete_button(url_for('.delete'), text="delete whole Product Tree") }}</div> {% endblock %}