Browse Source

Add button to clear current score

master
Ruben van de Ven 5 years ago
parent
commit
2a8903905e
  1. 21
      contextualise.py
  2. 4
      static/css/main.css
  3. 1
      templates/layout.html

21
contextualise.py

@ -44,19 +44,19 @@ pathofnumbers = []
app.secret_key = 'your secret'
app.config['SESSION_TYPE'] = 'filesystem'
def setupSession():
# session should be configured from within request context
# so this function should be called on each request
if 'wordpath' not in session:
def clearSession():
# 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()
def setupSession():
# session should be configured from within request context
# so this function should be called on each request
if 'veryfirstnow' not in session:
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]

4
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%;

1
templates/layout.html

@ -13,6 +13,7 @@
<div id="top">
<!-- WORDPATH -->
<div id="thewordpath">
{% if functionsession %}[<a href='/clear'>x</a>]{% endif %}
{% for item in functionsession %}
<span class="word">{{ item }} ▶ </span>
{% endfor %}

Loading…
Cancel
Save