Mercurial > farol
changeset 90:2201d0ea0bf3
Add deletion of Involvements
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 15:56:43 +0200 |
parents | e558238cfdb2 |
children | 6a61c02f2156 |
files | farol/templates/vulnerability/view_involvement.j2 farol/vulnerability.py |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/templates/vulnerability/view_involvement.j2 Thu Oct 09 15:50:31 2014 +0200 +++ b/farol/templates/vulnerability/view_involvement.j2 Thu Oct 09 15:56:43 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "vulnerability/base.j2" %} - +{% from "macros.j2" import delete_button %} {% block title %}{{ involvement.getTitle() }}{% endblock %} {% block i_content %} @@ -33,4 +33,5 @@ <h1>{{ involvement._party }} <small>{{ involvement._status }}</small></h1> </div> <p>{{ involvement._description or '' }}</p> +<div class="pull-right">{{ delete_button(url_for('.del_involvement', ordinal=ordinal, index=index)) }}</div> {% endblock %}
--- a/farol/vulnerability.py Thu Oct 09 15:50:31 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 15:56:43 2014 +0200 @@ -171,7 +171,6 @@ get_vuln(ordinal).addInvolvement(inv) return redirect(url_for('.view', ordinal=ordinal)) - @vulnerability.route('/<int:ordinal>/involvement/<int:index>/edit', methods=['GET', 'POST']) @document_required def edit_involvement(ordinal, index): @@ -187,6 +186,18 @@ involvement._description = request.form['description'] or None return redirect(url_for('.view_involvement', ordinal=ordinal, index=index)) +@vulnerability.route('/<int:ordinal>/involvement/<int:index>/del', methods=['POST']) +@document_required +def del_involvement(ordinal, index): + invls = get_vuln(ordinal)._involvements + if not ( 0 <= index < len(invls)): + flash('Involvement not found', 'danger') + abort(404) + + del invls[index] + return redirect(url_for('.view', ordinal=ordinal)) + + @vulnerability.route('/<int:ordinal>/cwe/<int:index>/edit', methods=['GET', 'POST']) @document_required def edit_cwe(ordinal, index):