diff --git a/contextualise.py b/contextualise.py index 4c81eec..4aaaf56 100644 --- a/contextualise.py +++ b/contextualise.py @@ -44,18 +44,18 @@ pathofnumbers = [] app.secret_key = 'your secret' app.config['SESSION_TYPE'] = 'filesystem' +def clearSession(): + # Flask sessions are serialised into a cookie, so we cannot use the deque here + session['wordpath'] = [] + session['clicktime'] = [] + session['id'] = [] + session['veryfirstnow'] = datetime.now().isoformat() + def setupSession(): # session should be configured from within request context # so this function should be called on each request - if 'wordpath' not in session: - # Flask sessions are serialised into a cookie, so we cannot use the deque here - session['wordpath'] = [] - if 'clicktime' not in session: - session['clicktime'] = [] - if 'id' not in session: - session['id'] = [] if 'veryfirstnow' not in session: - session['veryfirstnow'] = datetime.now().isoformat() + clearSession() # preparing the index.json file for the navbar index_dict = {} @@ -125,6 +125,13 @@ def about(): return render_template('about.html') +@app.route('/clear') +def clear(): + # return to a refer if its set, default to root + return_url = request.environ.get("HTTP_REFERER", '/') + clearSession() + return redirect(return_url) + # @app.route('/all/') # def all(): # thefile = listingfiles[positioninarray] diff --git a/static/css/main.css b/static/css/main.css index 4ec3d64..e08347a 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -151,9 +151,9 @@ div.explanation{ header{ /* border: lime 1px solid; */ padding-top: -1em; - padding-right: 10em; + margin-right: 10em; position: absolute; - top:12em; + top:17em; width: 29em; -webkit-transform-origin: 0 50%; -moz-transform-origin: 0 50%; diff --git a/templates/layout.html b/templates/layout.html index 7b9d7e1..c2277ce 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -13,6 +13,7 @@