From 6faa6b609ca80c7575e6be60a866452a0f4bace8 Mon Sep 17 00:00:00 2001 From: Burathar Date: Mon, 6 Jul 2020 01:09:07 +0200 Subject: [PATCH] Improve create_game datepicker, add game_dashboard --- app/forms.py | 3 ++- app/routes.py | 7 ++++++- app/templates/base.html | 2 ++ app/templates/create_game.html | 26 +++++++++++++++++++++++--- app/templates/game_dashboard.html | 5 +++++ requirements.txt | 6 ++++++ the_hunt.py | 3 ++- 7 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 app/templates/game_dashboard.html diff --git a/app/forms.py b/app/forms.py index b0d4c1b..40a889e 100644 --- a/app/forms.py +++ b/app/forms.py @@ -23,5 +23,6 @@ class RegistrationForm(FlaskForm): class CreateGameForm(FlaskForm): game_name = StringField('Game Name', validators=[DataRequired(), Length(min=0, max=64)]) - start_time = DateTimeField(id='datepick') + start_time = DateTimeField(id='datetimepicker1') + end_time = DateTimeField(id='datetimepicker2') submit = SubmitField('Register') \ No newline at end of file diff --git a/app/routes.py b/app/routes.py index 7ce20ec..e78f47f 100644 --- a/app/routes.py +++ b/app/routes.py @@ -50,4 +50,9 @@ def create_game(): if form.validate_on_submit(): game = Game(name=form.game_name.data) return render_template('create_game.html', title='Create Game!', form=form) - return render_template('create_game.html', title='Create Game', form=form) \ No newline at end of file + return render_template('create_game.html', title='Create Game', form=form) + +@login_required +@app.route('/game//admin') +def game_dashboard(): + return render_template('game_dashboard.html', title = 'Game Dashboard') \ No newline at end of file diff --git a/app/templates/base.html b/app/templates/base.html index fa7f1a2..ba377b2 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -19,7 +19,9 @@ {% endblock %} +TODO: +- maak time picker 24 uur based +https://eonasdan.github.io/bootstrap-datetimepicker/Options/#locale+ +- optie voor nu + {% block scripts %} - {{ super() }} + {{ super() }} + + {% endblock %} \ No newline at end of file diff --git a/app/templates/game_dashboard.html b/app/templates/game_dashboard.html new file mode 100644 index 0000000..0df7b55 --- /dev/null +++ b/app/templates/game_dashboard.html @@ -0,0 +1,5 @@ +{% extends 'base.html' %} + +{% block app_content %} +

Dashboard

+{% endblock %} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 1003e69..e1e41f7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,10 +3,13 @@ click==7.1.2 dominate==2.5.1 Flask==1.1.2 Flask-Bootstrap==3.3.7.1 +Flask-Login==0.5.0 Flask-Migrate==2.5.3 Flask-SQLAlchemy==2.4.3 +Flask-WTF==0.14.3 itsdangerous==1.1.0 Jinja2==2.11.2 +lazy-object-proxy==1.4.3 Mako==1.1.3 MarkupSafe==1.1.1 python-dateutil==2.8.1 @@ -14,5 +17,8 @@ python-dotenv==0.13.0 python-editor==1.0.4 six==1.15.0 SQLAlchemy==1.3.18 +typed-ast==1.4.1 visitor==0.1.3 Werkzeug==1.0.1 +wrapt==1.12.1 +WTForms==2.3.1 diff --git a/the_hunt.py b/the_hunt.py index 58edea0..ec10957 100644 --- a/the_hunt.py +++ b/the_hunt.py @@ -1,5 +1,6 @@ from app import app, db -from app.models import Game, Player, Objective, Location, Notification +from app.models import Game, Player, Objective, Location, Notification, GamePlayer, \ + PlayerFoundObjective, NotificationPlayer, PlayerCaughtPlayer, GameState @app.shell_context_processor def make_shell_context():