# HG changeset patch # User BenoƮt Allard # Date 1412863003 -7200 # Node ID 2201d0ea0bf3ab6c020264567fb39efcc91bdccd # Parent e558238cfdb23966f84520123ce95baad4457f44 Add deletion of Involvements diff -r e558238cfdb2 -r 2201d0ea0bf3 farol/templates/vulnerability/view_involvement.j2 --- 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 @@

{{ involvement._party }} {{ involvement._status }}

{{ involvement._description or '' }}

+
{{ delete_button(url_for('.del_involvement', ordinal=ordinal, index=index)) }}
{% endblock %} diff -r e558238cfdb2 -r 2201d0ea0bf3 farol/vulnerability.py --- 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('//involvement//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('//involvement//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('//cwe//edit', methods=['GET', 'POST']) @document_required def edit_cwe(ordinal, index):