Mercurial > farol
changeset 67:023080ffd995
Allow deletion of revisions
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 09:50:57 +0200 |
parents | f1705e90695b |
children | 33cdb9faed64 |
files | farol/document.py farol/static/style.css farol/templates/document/view.j2 |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/document.py Thu Oct 09 09:48:05 2014 +0200 +++ b/farol/document.py Thu Oct 09 09:50:57 2014 +0200 @@ -142,6 +142,13 @@ tracking._currentDate = date return redirect(url_for('.view')) +@document.route('/revision/del', methods=['POST']) +@document_required +def del_revision(): + index = int(request.form['index']) + del get_current()._tracking._history[index] + return redirect(url_for('.view')) + @document.route('/distribution/edit', methods=['GET', 'POST']) @document_required def edit_distribution():
--- a/farol/static/style.css Thu Oct 09 09:48:05 2014 +0200 +++ b/farol/static/style.css Thu Oct 09 09:50:57 2014 +0200 @@ -13,6 +13,11 @@ margin-bottom: -50px; } */ + +form.delete { + display: inline-block; +} + .footer { height: 130px; margin-top: 20px;
--- a/farol/templates/document/view.j2 Thu Oct 09 09:48:05 2014 +0200 +++ b/farol/templates/document/view.j2 Thu Oct 09 09:50:57 2014 +0200 @@ -60,7 +60,10 @@ {% for revision in cvrf._tracking._history %} <li class="list-group-item"> <div class="form-horizontal"> - <a class="pull-right" href="{{ url_for('.edit_revision', index=loop.index0) }}">edit revision</a> + <div class="pull-right"> + <a href="{{ url_for('.edit_revision', index=loop.index0) }}"><span class="label label-default">edit</span></a> + <form class="delete" role="button" action="{{ url_for('.del_revision') }}" method="POST"><input type=hidden name="index", value="{{ loop.index0 }}"><button type="submit" class="btn btn-link btn-xs"><span class="label label-danger"><strong>delete</strong></span></button></form> + </div> {{ label_value('Number', revision._number | join('.'), right=8) }} {{ label_value('Date', revision._date) }} {{ label_value('Description', revision._description) }}