Add button to clear current score
This commit is contained in:
parent
35cb77c398
commit
2a8903905e
@ -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]
|
||||
|
@ -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%;
|
||||
|
@ -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…
Reference in New Issue
Block a user