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.secret_key = 'your secret'
|
||||||
app.config['SESSION_TYPE'] = 'filesystem'
|
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():
|
def setupSession():
|
||||||
# session should be configured from within request context
|
# session should be configured from within request context
|
||||||
# so this function should be called on each request
|
# 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:
|
if 'veryfirstnow' not in session:
|
||||||
session['veryfirstnow'] = datetime.now().isoformat()
|
clearSession()
|
||||||
|
|
||||||
# preparing the index.json file for the navbar
|
# preparing the index.json file for the navbar
|
||||||
index_dict = {}
|
index_dict = {}
|
||||||
@ -125,6 +125,13 @@ def about():
|
|||||||
|
|
||||||
return render_template('about.html')
|
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/')
|
# @app.route('/all/')
|
||||||
# def all():
|
# def all():
|
||||||
# thefile = listingfiles[positioninarray]
|
# thefile = listingfiles[positioninarray]
|
||||||
|
@ -151,9 +151,9 @@ div.explanation{
|
|||||||
header{
|
header{
|
||||||
/* border: lime 1px solid; */
|
/* border: lime 1px solid; */
|
||||||
padding-top: -1em;
|
padding-top: -1em;
|
||||||
padding-right: 10em;
|
margin-right: 10em;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top:12em;
|
top:17em;
|
||||||
width: 29em;
|
width: 29em;
|
||||||
-webkit-transform-origin: 0 50%;
|
-webkit-transform-origin: 0 50%;
|
||||||
-moz-transform-origin: 0 50%;
|
-moz-transform-origin: 0 50%;
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
<div id="top">
|
<div id="top">
|
||||||
<!-- WORDPATH -->
|
<!-- WORDPATH -->
|
||||||
<div id="thewordpath">
|
<div id="thewordpath">
|
||||||
|
{% if functionsession %}[<a href='/clear'>x</a>]{% endif %}
|
||||||
{% for item in functionsession %}
|
{% for item in functionsession %}
|
||||||
<span class="word">{{ item }} ▶ </span>
|
<span class="word">{{ item }} ▶ </span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user