muizenval

Observe mouse traps remotely
Log | Files | Refs

commit 3ac5ed0e3a543979aabe3b76cfa820ea7b4aed2f
parent fa9a66c1a991b79f78cb8252609fedf6f93fe85a
Author: gerco <[email protected]>
Date:   Fri, 20 May 2022 08:33:22 +0200

small bug fixes

Diffstat:
Mserver/forms.py | 2+-
Mserver/routes.py | 2+-
Mserver/site.db | 0
Mserver/templates/backup.html | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
Mserver/templates/layout.html | 47+++++++++++++++++++++++++++++++++++++++++------
Mserver/templates/trap.html | 1+
6 files changed, 107 insertions(+), 10 deletions(-)

diff --git a/server/forms.py b/server/forms.py @@ -16,7 +16,7 @@ class RegistrationForm(FlaskForm): phone = StringField('Telefoon', validators=[ DataRequired(), Length(min=5) ]) street = StringField('Straat', validators=[ DataRequired() ]) housenumber = IntegerField('Huisnummer', validators=[ DataRequired() ]) - zipcode = StringField('Postcode', validators=[ DataRequired() ]) + postcode = StringField('Postcode', validators=[ DataRequired() ]) place = StringField('Plaats', validators=[ DataRequired() ]) submit = SubmitField('Registeren') diff --git a/server/routes.py b/server/routes.py @@ -84,7 +84,7 @@ def register(): form = RegistrationForm() if form.validate_on_submit(): hashed_password = bcrypt.generate_password_hash(form.password.data).decode('utf-8') - address = f"{form.street} {form.housenumber}\n{form.zipcode} {form.place}" + address = f"{form.street} {form.housenumber}\n{form.postcode} {form.place}" user = User( name=form.name.data, email=form.email.data, diff --git a/server/site.db b/server/site.db Binary files differ. diff --git a/server/templates/backup.html b/server/templates/backup.html @@ -93,4 +93,65 @@ </div> </nav> </header> -<!--nav bar--> -\ No newline at end of file +<!--nav bar--><body> + <nav class="navbar fixed-top bg-light"> + <div class="container"> + <a class="navbar-brand" href="{{ url_for('index') }}"> + <img src="static/logo.svg" alt="" width="50%" height="50%"> + Home + </a> + <ul class="navbar-nav"> + <li class="nav-item"> + <a class="nav-link" aria-current="page" href="{{ url_for('login') }}">Inloggen</a> + </li> + <li class="nav-item"> + <a class="nav-link" aria-current="page" href="{{ url_for('register') }}">Registeren</a> + </li> + </ul> + </div> + </nav> + <div class="container" style="padding-top:20px;"> + <div class="row"> + <!-- sidebar --> + <div class="col-3"> + <ul class="nav nav-pills flex-column nav-justified"> + <li class="nav-item"> + <a class="nav-link" href="{{url_for('index')}}}">Home</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="{{url_for('producten')}}">Producten</a> + </li> + <li class="nav-item"> + <a class="nav-link" href="#">Link</a> + </li> + <li class="nav-item"> + <a class="nav-link disabled">Disabled</a> + </li> + {% if current_user.is_authenticated %} + <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">{{current_user.name}} + + </a> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="{{ url_for('account') }}">Instellingen</a></li> + <li><a class="dropdown-item" href="{{ url_for('logout') }}">Uitloggen</a></li> + </ul> + {% endif %} + </ul> + </div> + <!-- content--> + <div class="col-7"> + {% block content %}{% endblock %} + </div> + </div> + </div> + {{ form.email.label(class="form-control-label") }} + {% if form.email.errors %} + {{ form.email(class="form-control form-control-lg is-invalid") }} + <div class="invalid-feedback"> + {% for error in form.email.errors %} + <span>{{ error }}</span> + {% endfor %} + </div> + {% else %} + {{ form.email(class="form-control form-control-lg") }} + {% endif %} +\ No newline at end of file diff --git a/server/templates/layout.html b/server/templates/layout.html @@ -42,6 +42,12 @@ var socket = io(); var current_user = {{ current_user.id if current_user.is_authenticated else none | tojson }}; // socket.on('connect', function () { }); + $('.dropdown-toggle').dropdown() + + $(document).ready(function() { + $('li.active a').removeClass('active'); + $('a[href="' + location.pathname + '"]').closest('li ').addClass('active'); + }); </script> {% if title %} @@ -81,9 +87,9 @@ <div class="col-3"> <ul class="nav nav-pills flex-column nav-justified"> {% if current_user.is_authenticated %} - <li class="nav-item"> + <!--<li class="nav-item"> <a class="nav-link" href="{{ url_for('account') }}"><b>{{current_user.name}}</b></a> - </li> + </li>--> <li class="nav-item"> <a class="nav-link" href="{{ url_for('traps') }}">Dashboard</a> </li> @@ -104,8 +110,8 @@ <li class="nav-item"> <a class="nav-link" href="{{ url_for('about') }}">Over ons</a> </li> - - <!-- + {% if current_user.is_authenticated %} + <div class="dropdown-divider"></div> <div class="dropdown"> <li class="nav-item"> <a class="nav-link dropdown-toggle" href="#" role="button" id="account-dropdown" @@ -115,13 +121,42 @@ <div class="dropdown-menu" aria-labelledby="account-dropdown"> <a class="dropdown-item" href="{{ url_for('account') }}">Instellingen</a> + <div class="dropdown-divider"></div> <a class="dropdown-item" href="{{ url_for('logout') }}">Uitloggen</a> </div> </li> - </div>--> + </div> + {% endif %} </ul> </div> - + <!-- + <ul class="nav nav-pills flex-column" id="myTab" role="tablist"> + <li class="nav-item"> + <a class="nav-link active" id="home-tab" data-toggle="tab" href="#home" role="tab" aria-controls="home" aria-selected="true">Home</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="profile" aria-selected="false">Profile</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="messages-tab" data-toggle="tab" href="#messages" role="tab" aria-controls="messages" aria-selected="false">Messages</a> + </li> + <li class="nav-item"> + <a class="nav-link" id="settings-tab" data-toggle="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false">Settings</a> + </li> + </ul> + + <div class="tab-content"> + <div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab">...1</div> + <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab">..2.</div> + <div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab">.4..</div> + <div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab">.3..</div> + </div> + --> + <script> + $(function () { + $('#myTab li:last-child a').tab('show') + }) + </script> <!-- content--> <div class="col-7"> {% for category, message in get_flashed_messages(with_categories=true) %} diff --git a/server/templates/trap.html b/server/templates/trap.html @@ -2,6 +2,7 @@ {% block content %} <article class="media content-section"> <div class="media-body"> + <h1 style="text-align:center;">Dashboard</h1> <div id="trap-map"></div> </div> </article>