diff --git a/fishbowl/app.py b/fishbowl/app.py
index 0e2be74..0043b1e 100644
--- a/fishbowl/app.py
+++ b/fishbowl/app.py
@@ -9,6 +9,7 @@ from flask import render_template
from flask import request
from flask import session
from flask import url_for
+from flask import flash
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm
@@ -97,7 +98,9 @@ class AddWordForm(FlaskForm):
class PlayGameForm(FlaskForm):
- draw_word = SubmitField(label='Draw word')
+ draw_word = SubmitField(
+ label='Draw word',
+ )
class ResetGameForm(FlaskForm):
@@ -149,6 +152,8 @@ def game(game_uuid):
if word_form.submit_new_word.data and word_form.validate():
word = Word(text=word_form.new_word.data)
game.words.append(word)
+ flash(f"Word added: {word.text}")
+ word = None
# We just drew a new word!
if play_form.draw_word.data:
words = game.get_remaining_words()
@@ -156,6 +161,10 @@ def game(game_uuid):
word = choice(words)
word.is_picked = True
else:
+ flash(
+ "No words left to draw. Either add more or reset.",
+ "warning",
+ )
word = None
# Reset the game
if reset_form.reset_game.data and reset_form.validate():
diff --git a/fishbowl/templates/base.html b/fishbowl/templates/base.html
index 96b30c7..5993e2c 100644
--- a/fishbowl/templates/base.html
+++ b/fishbowl/templates/base.html
@@ -1,4 +1,5 @@
{% from 'bootstrap/nav.html' import render_nav_item %}
+{% from 'bootstrap/utils.html' import render_messages %}
@@ -23,6 +24,7 @@
Your word is: {{ word.text }}
{% endif %}Words remaining: {{ words|length }}
- {{ render_form(play_form) }} + {{ render_form(play_form, button_map={"draw_word": "primary"}) }}Make all drawn words pickable again
- {{ render_form(reset_form) }} + {{ render_form(reset_form, button_map={"reset_game": "danger"}) }}