Mercurial > farol
changeset 132:812e613cbbb4
Add possibility to delete the current document.
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Fri, 24 Oct 2014 12:59:35 +0200 |
parents | 75c053bf2c3a |
children | b4bb5966af01 |
files | farol/document.py farol/templates/document/view.j2 |
diffstat | 2 files changed, 15 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/document.py Fri Oct 24 10:53:37 2014 +0200 +++ b/farol/document.py Fri Oct 24 12:59:35 2014 +0200 @@ -34,7 +34,7 @@ update_reference_from_request, create_reference_from_request, update_acknowledgment_from_request, create_acknowledgment_from_request, split_fields, parseDate, parseVersion) -from .session import document_required, get_current +from .session import document_required, get_current, del_current document = Blueprint('document', __name__) @@ -45,6 +45,11 @@ cvrf = get_current() return render_template('document/view.j2', cvrf=cvrf) +@document.route('/delete', methods=['POST']) +def delete(): + del_current() + return redirect(url_for('welcome')) + @document.route('/title/edit', methods=['GET', 'POST']) @document_required def edit_title():
--- a/farol/templates/document/view.j2 Fri Oct 24 10:53:37 2014 +0200 +++ b/farol/templates/document/view.j2 Fri Oct 24 12:59:35 2014 +0200 @@ -169,4 +169,13 @@ {% endcall %} </div> </div> +<div class="pull-right"><a href="#delete_modal" data-toggle="modal" class="btn btn-danger btn-xs" role="btn">delete</a></div> +{% call modal('delete_modal', 'Delete document') %} + <p>This will delete the document <strong>{{ current_id }}</strong>.</p> + <p>Are you sure ?</p> +</div> +<div class="modal-footer"> + <button type="button" class="btn btn-link" data-dismiss="modal">Cancel</button> + {{ POST_button(url_for('.delete'), text="Delete " + cvrf.getDocId(), style="btn-danger") }} +{% endcall %} {% endblock %}