1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

settings page reflects user's settings

This commit is contained in:
Lynne Megido 2019-09-02 17:49:39 +10:00
parent 913b5ed338
commit bf7571eba1
2 changed files with 22 additions and 18 deletions

View file

@ -20,7 +20,7 @@
<div class="row"> <div class="row">
<label for="email" class="large">Email address</label> <label for="email" class="large">Email address</label>
<input type="email" name="email" value="me@my.site"> <input type="email" name="email" value="{{ user['email'] }}">
</div> </div>
<div class="row"> <div class="row">
<label for="password" class="large">Password</label> <label for="password" class="large">Password</label>
@ -33,35 +33,35 @@
</div> </div>
<div class="row"> <div class="row">
<label for="download-error" class="large">When my bot(s) can't get new posts</label> <label for="fetch-error" class="large">When my bot(s) can't get new posts</label>
<select name="download-error"> <select name="fetch-error">
<option value="once">Once</option> <option value="always" {{ 'selected' if user['fetch'] == "always"}}>Always</option>
<option value="every-time">Every time</option> <option value="once" {{ 'selected' if user['fetch'] == "once"}}>Once</option>
<option value="never">Never</option> <option value="never" {{ 'selected' if user['fetch'] == "never"}}>Never</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
<label for="post-error" class="large">When my bot(s) can't submit new posts</label> <label for="submit-error" class="large">When my bot(s) can't submit new posts</label>
<select name="post-error"> <select name="submit-error">
<option value="once">Once</option> <option value="always" {{ 'selected' if user['submit'] == "always"}}>Always</option>
<option value="every-time">Every time</option> <option value="once" {{ 'selected' if user['submit'] == "once"}}>Once</option>
<option value="never">Never</option> <option value="never" {{ 'selected' if user['submit'] == "never"}}>Never</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
<label for="generation-error" class="large">When my bot(s) encounter an error generating new posts</label> <label for="generation-error" class="large">When my bot(s) encounter an error generating new posts</label>
<select name="generation-error"> <select name="generation-error">
<option value="once">Once</option> <option value="always" {{ 'selected' if user['generation'] == "always"}}>Always</option>
<option value="every-time">Every time</option> <option value="once" {{ 'selected' if user['generation'] == "once"}}>Once</option>
<option value="never">Never</option> <option value="never" {{ 'selected' if user['generation'] == "never"}}>Never</option>
</select> </select>
</div> </div>
<div class="row"> <div class="row">
<label for="reply-error" class="large">When my bot(s) can't send replies</label> <label for="reply-error" class="large">When my bot(s) can't send replies</label>
<select name="reply-error"> <select name="reply-error">
<option value="once">Once</option> <option value="always" {{ 'selected' if user['reply'] == "always"}}>Always</option>
<option value="every-time">Every time</option> <option value="once" {{ 'selected' if user['reply'] == "once"}}>Once</option>
<option value="never">Never</option> <option value="never" {{ 'selected' if user['reply'] == "never"}}>Never</option>
</select> </select>
</div> </div>

View file

@ -69,7 +69,11 @@ def show_signup_page(error = None):
@app.route("/settings") @app.route("/settings")
def settings(): def settings():
return render_template("settings.html") dc = mysql.connection.cursor(MySQLdb.cursors.DictCursor)
dc.execute("SELECT * FROM `users` WHERE id = %s", (session['user_id'],))
user = dc.fetchone()
dc.close()
return render_template("settings.html", user = user)
@app.route("/bot/edit/<id>") @app.route("/bot/edit/<id>")
def bot_edit(id): def bot_edit(id):