Mercurial > farol
changeset 89:e558238cfdb2
Add deletion of Vulnerabilities'Notes
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 15:50:31 +0200 |
parents | 521c0ec35338 |
children | 2201d0ea0bf3 |
files | farol/templates/vulnerability/view_note.j2 farol/vulnerability.py |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ </div> {% if note._audience %}<p>Audience: <em>{{ note._audience }}</em></p>{% endif %} <p>{{ note._note | replace('\n', '<br>') }}</p> +<div class="pull-right">{{ delete_button(url_for('.del_note', ordinal=ordinal, note_ordinal=note._ordinal)) }}</div> {% endblock %}
--- 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('/<int:ordinal>/note/<int:note_ordinal>/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('/<int:ordinal>/involvement/<int:index>') @document_required