aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/__init__.py2
-rw-r--r--app/templates/404.html2
-rw-r--r--app/templates/500.html2
-rw-r--r--app/templates/base.html59
-rw-r--r--app/templates/index.html2
-rw-r--r--app/templates/login.html2
-rw-r--r--app/templates/register.html42
-rw-r--r--app/templates/reset_password.html28
-rw-r--r--app/templates/reset_password_request.html20
-rw-r--r--poetry.lock34
-rw-r--r--pyproject.toml1
11 files changed, 103 insertions, 91 deletions
diff --git a/app/__init__.py b/app/__init__.py
index 2c4cc32..3ee019e 100644
--- a/app/__init__.py
+++ b/app/__init__.py
@@ -8,6 +8,7 @@ import os
from logging.handlers import SMTPHandler, RotatingFileHandler
from flask import Flask
+from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import LoginManager
@@ -22,6 +23,7 @@ migrate = Migrate(app, db)
login = LoginManager(app)
login.login_view = "login"
mail = Mail(app)
+bootstrap = Bootstrap(app)
from app import routes, models, errors
diff --git a/app/templates/404.html b/app/templates/404.html
index 7dde47e..51295c4 100644
--- a/app/templates/404.html
+++ b/app/templates/404.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
-{% block content %}
+{% block app_content %}
<h1>Page Not Found</h1>
<p><a href="{{ url_for('index') }}">Home</p>
{% endblock %}
diff --git a/app/templates/500.html b/app/templates/500.html
index ca8830c..adda72b 100644
--- a/app/templates/500.html
+++ b/app/templates/500.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
-{% block content %}
+{% block app_content %}
<h1>An unexpected error has occurred</h1>
<p>The administrator has been notified, apologies for the inconvenience.</p>
<p><a href="{{ url_for('index') }}">Home</p>
diff --git a/app/templates/base.html b/app/templates/base.html
index 3070587..ee03e3d 100644
--- a/app/templates/base.html
+++ b/app/templates/base.html
@@ -1,21 +1,39 @@
-<html>
- <head>
- {% if title %}
- <title>{{ title }} - Annotate Change</title>
- {% else %}
- <title>Welcome to Annotate Change</title>
- {% endif %}
- </head>
- <body>
- <div>Annotate Change:
- <a href="{{ url_for('index') }}">Home</a>
- {% if current_user.is_anonymous %}
- <a href="{{ url_for('login') }}">Login</a>
- {% else %}
- <a href="{{ url_for('logout') }}">Logout</a>
- {% endif %}
+{% extends 'bootstrap/base.html' %}
+
+{% block title %}
+ {% if title %}{{ title }} -- AnnotateChange{% else %}Welcome to AnnotateChange{% endif %}
+{% endblock %}
+
+{% block navbar %}
+ <nav class="navbar navbar-default">
+ <div class="container">
+ <div class="navbar-header">
+ <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
+ <span class="sr-only">Toggle navigation</span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ <span class="icon-bar"></span>
+ </button>
+ <a class="navbar-brand" href="{{ url_for('index') }}">AnnotateChange</a>
+ </div>
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
+ <ul class="nav navbar-nav">
+ <li><a href="{{ url_for('index') }}">Home</a></li>
+ </ul>
+ <ul class="nav navbar-nav navbar-right">
+ {% if current_user.is_anonymous %}
+ <li><a href="{{ url_for('login') }}">Login</a></li>
+ {% else %}
+ <li><a href="{{ url_for('logout') }}">Logout</a></li>
+ {% endif %}
+ </ul>
+ </div>
</div>
- <hr>
+ </nav>
+{% endblock %}
+
+{% block content %}
+ <div class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
<ul>
@@ -25,7 +43,8 @@
</ul>
{% endif %}
{% endwith %}
- {% block content %}
+
+ {% block app_content %}
{% endblock %}
- </body>
-</html>
+ </div>
+{% endblock %}
diff --git a/app/templates/index.html b/app/templates/index.html
index 3cf36ee..7c6793a 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -1,5 +1,5 @@
{% extends "base.html" %}
-{% block content %}
+{% block app_content %}
<h1>Hi, {{ current_user.username }}!</h1>
{% endblock %}
diff --git a/app/templates/login.html b/app/templates/login.html
index 4d5181b..9b862f6 100644
--- a/app/templates/login.html
+++ b/app/templates/login.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
-{% block content %}
+{% block app_content %}
<h1>Sign In</h1>
<form action="" method="post" novalidate>
{{ form.hidden_tag() }}
diff --git a/app/templates/register.html b/app/templates/register.html
index 487b860..c430b38 100644
--- a/app/templates/register.html
+++ b/app/templates/register.html
@@ -1,37 +1,11 @@
{% extends "base.html" %}
+{% import 'bootstrap/wtf.html' as wtf %}
-{% block content %}
- <h1>Register</h1>
- <form action="" method="post">
- {{ form.hidden_tag() }}
- <p>
- {{ form.username.label }}<br>
- {{ form.username(size=32) }}<br>
- {% for error in form.username.errors %}
- <span style="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>
- {{ form.email.label }}<br>
- {{ form.email(size=64) }}<br>
- {% for error in form.email.errors %}
- <span style="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>
- {{ form.password.label }}<br>
- {{ form.password(size=32) }}<br>
- {% for error in form.password.errors %}
- <span style="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>
- {{ form.password2.label }}<br>
- {{ form.password2(size=32) }}<br>
- {% for error in form.password2.errors %}
- <span style="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>{{ form.submit() }}</p>
- </form>
+{% block app_content %}
+<h1>Register</h1>
+<div class="row">
+ <div class="col-md-4">
+ {{ wtf.quick_form(form) }}
+ </div>
+</div>
{% endblock %}
diff --git a/app/templates/reset_password.html b/app/templates/reset_password.html
index da3aa95..cab00c9 100644
--- a/app/templates/reset_password.html
+++ b/app/templates/reset_password.html
@@ -1,23 +1,11 @@
{% extends "base.html" %}
+{% import 'bootstrap/wtf.html' as wtf %}
-{% block content %}
- <h1>Reset Your Password</h1>
- <form action="" method="post">
- {{ form.hidden_tag() }}
- <p>
- {{ form.password.label }}<br>
- {{ form.password(size=32) }}<br>
- {% for error in form.password.errors %}
- <span stle="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>
- {{ form.password2.label }}<br>
- {{ form.password2(size=32) }}<br>
- {% for error in form.password2.errors %}
- <span stle="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- <p>{{ form.submit() }}</p>
- </form>
+{% block app_content %}
+<h1>Reset Your Password</h1>
+<div class="row">
+ <div class="col-md-4">
+ {{ wtf.quick_form(form) }}
+ </div>
+</div>
{% endblock %}
diff --git a/app/templates/reset_password_request.html b/app/templates/reset_password_request.html
index 914c593..c516141 100644
--- a/app/templates/reset_password_request.html
+++ b/app/templates/reset_password_request.html
@@ -1,15 +1,11 @@
{% extends "base.html" %}
+{% import 'bootstrap/wtf.html' as wtf %}
-{% block content %}
- <h1>Reset Password</h1>
- <form action="" method="post">
- {{ form.hidden_tag() }}
- <p>
- {{ form.email.label }}<br>
- {{ form.email(size=64) }}<br>
- {% for error in form.email.errors %}
- <span style="color: red;">[{{ error }}]</span>
- {% endfor %}
- </p>
- </form>
+{% block app_content %}
+<h1>Reset Password</h1>
+<div class="row">
+ <div class="col-md-4">
+ {{ wtf.quick_form(form) }}
+ </div>
+</div>
{% endblock %}
diff --git a/poetry.lock b/poetry.lock
index e55db49..8c363e0 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -55,6 +55,14 @@ version = "0.4.1"
[[package]]
category = "main"
+description = "Dominate is a Python library for creating and manipulating HTML documents using an elegant DOM API."
+name = "dominate"
+optional = false
+python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
+version = "2.3.5"
+
+[[package]]
+category = "main"
description = "A simple framework for building complex web applications."
name = "flask"
optional = false
@@ -69,6 +77,19 @@ itsdangerous = ">=0.24"
[[package]]
category = "main"
+description = "An extension that includes Bootstrap in your project, without any boilerplate code."
+name = "flask-bootstrap"
+optional = false
+python-versions = "*"
+version = "3.3.7.1"
+
+[package.dependencies]
+Flask = ">=0.8"
+dominate = "*"
+visitor = "*"
+
+[[package]]
+category = "main"
description = "User session management for Flask"
name = "flask-login"
optional = false
@@ -252,6 +273,14 @@ version = "1.3.1"
[[package]]
category = "main"
+description = "A tiny pythonic visitor implementation."
+name = "visitor"
+optional = false
+python-versions = "*"
+version = "0.1.3"
+
+[[package]]
+category = "main"
description = "The comprehensive WSGI web application library."
name = "werkzeug"
optional = false
@@ -267,7 +296,7 @@ python-versions = "*"
version = "2.2.1"
[metadata]
-content-hash = "9a6fe4da6688473eccb96a2040775d70a02f90bf4e77527a88af7c8a0da31964"
+content-hash = "402e59e5c5f6451d19d07c09e123a70dc68a3f4f7d698ef42f18fd521335e143"
python-versions = "^3.7"
[metadata.hashes]
@@ -277,7 +306,9 @@ attrs = ["69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79", "f0
blinker = ["471aee25f3992bd325afa3772f1063dbdbbca947a041b8b89466dc00d606f8b6"]
click = ["2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", "5b94b49521f6456670fdb30cd82a4eca9412788a93fa6dd6df72c94d5a8ff2d7"]
colorama = ["05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", "f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"]
+dominate = ["4076735c0745fe771e57b2313dbb4bfeec42731816ee23cee509f66e8912aa51", "4b9fd42d2824b79761799590697db45bf93daad511b130c50513af38da33df9b"]
flask = ["2271c0070dbcb5275fad4a82e29f23ab92682dc45f9dfbc22c02ba9b9322ce48", "a080b744b7e345ccfcbc77954861cb05b3c63786e93f2b3875e0913d44b43f05"]
+flask-bootstrap = ["cb08ed940183f6343a64e465e83b3a3f13c53e1baabb8d72b5da4545ef123ac8"]
flask-login = ["c815c1ac7b3e35e2081685e389a665f2c74d7e077cb93cecabaea352da4752ec"]
flask-mail = ["22e5eb9a940bf407bcf30410ecc3708f3c56cc44b29c34e1726fe85006935f41"]
flask-migrate = ["a361578cb829681f860e4de5ed2c48886264512f0c16144e404c36ddc95ab49c", "c24d105c5d6cc670de20f8cbfb909e04f4e04b8784d0df070005944de1f21549"]
@@ -296,5 +327,6 @@ python-dateutil = ["7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493d
python-editor = ["1bf6e860a8ad52a14c3ee1252d5dc25b2030618ed80c022598f00176adc8367d", "51fda6bcc5ddbbb7063b2af7509e43bd84bfc32a4ff71349ec7847713882327b", "5f98b069316ea1c2ed3f67e7f5df6c0d8f10b689964a4a811ff64f0106819ec8", "c3da2053dbab6b29c94e43c486ff67206eafbe7eb52dbec7390b5e2fb05aac77", "ea87e17f6ec459e780e4221f295411462e0d0810858e055fc514684350a2f522"]
six = ["3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73"]
sqlalchemy = ["781fb7b9d194ed3fc596b8f0dd4623ff160e3e825dd8c15472376a438c19598b"]
+visitor = ["2c737903b2b6864ebc6167eef7cf3b997126f1aa94bdf590f90f1436d23e480a"]
werkzeug = ["c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c", "d5da73735293558eb1651ee2fddc4d0dedcfa06538b8813a2e20011583c9e49b"]
wtforms = ["0cdbac3e7f6878086c334aa25dc5a33869a3954e9d1e015130d65a69309b3b61", "e3ee092c827582c50877cdbd49e9ce6d2c5c1f6561f849b3b068c1b8029626f1"]
diff --git a/pyproject.toml b/pyproject.toml
index c7c8391..f706bcd 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -13,6 +13,7 @@ flask-migrate = "^2.4"
flask-login = "^0.4.1"
flask-mail = "^0.9.1"
pyjwt = "^1.7"
+flask-bootstrap = "^3.3"
[tool.poetry.dev-dependencies]
pytest = "^3.0"