# HG changeset patch # User BenoƮt Allard # Date 1413275143 -7200 # Node ID 65341d05a8f8737e3899fa586dbf2cba8872589e # Parent 21a1a69b4525c296a8c5879299bd18352d47bfde Spawn a Modal when loading a doc, and another one is already loaded diff -r 21a1a69b4525 -r 65341d05a8f8 farol/main.py --- a/farol/main.py Tue Oct 14 10:23:08 2014 +0200 +++ b/farol/main.py Tue Oct 14 10:25:43 2014 +0200 @@ -80,7 +80,8 @@ error = None except ValidationError as ve: error = ve - return dict(has_current=True, vulnerabilities=vulns, products=prods, error=error) + return dict(has_current=True, vulnerabilities=vulns, products=prods, + error=error, current_id=cvrf.getDocId()) @app.template_filter('secure_filename') def makeId(string): @@ -140,10 +141,7 @@ @app.route('/new', methods=['GET', 'POST']) def new(): if request.method != 'POST': - current_id = None - if has_current(): - current_id = get_current().getDocId() - return render_template('new.j2', has_document=has_current(), now=utcnow(), current_id=current_id) + return render_template('new.j2', has_document=has_current(), now=utcnow()) if 'rhsa' in request.form: set_RHSA(request.form['id']) diff -r 21a1a69b4525 -r 65341d05a8f8 farol/static/style.css --- a/farol/static/style.css Tue Oct 14 10:23:08 2014 +0200 +++ b/farol/static/style.css Tue Oct 14 10:25:43 2014 +0200 @@ -18,6 +18,11 @@ display: inline-block; } +/* To behave as a link, it should'nt have padding ... */ +.btn-link { + padding: 0; +} + .footer { height: 130px; margin-top: 20px; diff -r 21a1a69b4525 -r 65341d05a8f8 farol/templates/base.j2 --- a/farol/templates/base.j2 Tue Oct 14 10:23:08 2014 +0200 +++ b/farol/templates/base.j2 Tue Oct 14 10:25:43 2014 +0200 @@ -23,6 +23,8 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -#} +{% from "macros.j2" import modal, POST_button -%} + @@ -96,10 +98,20 @@ {% endif %} @@ -107,6 +119,19 @@ {# /.navbar-collapse #} {# /.container-fluid #} + {% if has_current %} + {% for element in cache %} + {# Put the modals for the load action here #} + {% call modal(element + '_modal', 'Load %s from cache' % element) %} +

You asked to load {{ element }}, your changes to {{ current_id }} will be lost.

+

Do you want to save {{ current_id }} first ?

+ +