# HG changeset patch # User BenoƮt Allard # Date 1412862631 -7200 # Node ID e558238cfdb23966f84520123ce95baad4457f44 # Parent 521c0ec35338a568695d7c08240cdcb599fb0fd7 Add deletion of Vulnerabilities'Notes diff -r 521c0ec35338 -r e558238cfdb2 farol/templates/vulnerability/view_note.j2 --- a/farol/templates/vulnerability/view_note.j2 Thu Oct 09 15:37:51 2014 +0200 +++ b/farol/templates/vulnerability/view_note.j2 Thu Oct 09 15:50:31 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "vulnerability/base.j2" %} - +{% from "macros.j2" import delete_button %} {% block title %}{{ note._title }}{% endblock %} {% block i_content %} @@ -34,4 +34,5 @@ {% if note._audience %}

Audience: {{ note._audience }}

{% endif %}

{{ note._note | replace('\n', '
') }}

+
{{ delete_button(url_for('.del_note', ordinal=ordinal, note_ordinal=note._ordinal)) }}
{% endblock %} diff -r 521c0ec35338 -r e558238cfdb2 farol/vulnerability.py --- a/farol/vulnerability.py Thu Oct 09 15:37:51 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 15:50:31 2014 +0200 @@ -139,6 +139,17 @@ get_vuln(ordinal).addNote(note) return redirect(url_for('.view', ordinal=ordinal)) +@vulnerability.route('//note//del', methods=['POST']) +@document_required +def del_note(ordinal, note_ordinal): + vuln = get_vuln(ordinal) + note = vuln.getNote(ordinal) + if note is None: + flash('Note not found', 'danger') + abort(404) + vuln._notes.remove(note) + return redirect(url_for('.view', ordinal=ordinal)) + @vulnerability.route('//involvement/') @document_required