changeset 27:69e0330c4fae

Display the id of the current document when asking to save it
author Benoît Allard <benoit.allard@greenbone.net>
date Thu, 02 Oct 2014 12:08:48 +0200
parents 33a3a36b5bf6
children 6c65b16f2680
files farol/main.py farol/templates/new.j2
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/farol/main.py	Thu Oct 02 12:07:40 2014 +0200
+++ b/farol/main.py	Thu Oct 02 12:08:48 2014 +0200
@@ -139,7 +139,11 @@
 @app.route('/new', methods=['GET', 'POST'])
 def new():
     if request.method != 'POST':
-        return render_template('new.j2', has_document=has_current(), now=utcnow())
+        current_id = None
+        cvrf = get_current()
+        if has_current():
+            current_id = get_current()._tracking._identification._id
+        return render_template('new.j2', has_document=has_current(), now=utcnow(), current_id=current_id)
 
     if 'rhsa' in request.form:
         set_RHSA(request.form['id'])
--- a/farol/templates/new.j2	Thu Oct 02 12:07:40 2014 +0200
+++ b/farol/templates/new.j2	Thu Oct 02 12:08:48 2014 +0200
@@ -32,7 +32,7 @@
 
 {% block content %}
 {% if has_document and caching %}
-<p class="text-danger">You have an unsaved document, maybe you want to <a href={{ url_for('cache.save') }}>save</a> it first ?</p>
+<p class="text-danger">You are currently editing a document: <strong>{{ current_id }}</strong>. Loading a new one will lose your modifications. Do you want to <a href={{ url_for('cache.save') }}>save</a> it first ?</p>
 {% endif %}
 <h3>New Document</h3>
 

http://farol.wald.intevation.org