Skip to content

Commit

Permalink
Merge pull request wait-how#11 from PICOVERAVR/input-testing-lance
Browse files Browse the repository at this point in the history
Optimize test buttons
  • Loading branch information
Lants authored Feb 18, 2022
2 parents 95fef47 + 160ac30 commit 5beb80c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
17 changes: 10 additions & 7 deletions src/UI_Integrations/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ def home():
# smol page route
@app.route("/smol", methods=['POST', 'GET'])
def smol():
if 'On Button' in request.form:
print("smol: On button pressed")
test_data[0]['content'] = 'ON'
elif 'Off Button' in request.form:
print("smol: Off button pressed")
test_data[0]['content'] = 'OFF'
turbo.push(turbo.replace(render_template('smol_button_status.html'), 'button_status'))
if request.method == 'POST':
if request.form['On-Off Button'] == 'on':
print("smol: On button pressed")
test_data[0]['content'] = 'ON'
turbo.push(turbo.replace(render_template('smol_button_status.html'), 'button_status'))
elif request.form['On-Off Button'] == 'off':
print("smol: Off button pressed")
test_data[0]['content'] = 'OFF'
turbo.push(turbo.replace(render_template('smol_button_status.html'), 'button_status'))

return render_template("smol.html", title='smol')


Expand Down
4 changes: 2 additions & 2 deletions src/UI_Integrations/templates/smol.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ <h1>Control Panel (smol)</h1>
<legend class="form-group">
<div class="form-group">
<form action="" method="post">
<input type="submit" name="On Button" value="on">
<input type="submit" name="Off Button" value="off">
<input type="submit" name="On-Off Button" value="on">
<input type="submit" name="On-Off Button" value="off">
</form>
</div>
</legend>
Expand Down

0 comments on commit 5beb80c

Please sign in to comment.