diff options
Diffstat (limited to 'app/templates')
-rw-r--r-- | app/templates/add_product.html | 44 | ||||
-rw-r--r-- | app/templates/base.html | 30 | ||||
-rw-r--r-- | app/templates/errors/module-not-found.html | 14 | ||||
-rw-r--r-- | app/templates/home.html | 22 | ||||
-rw-r--r-- | app/templates/modules/calculator.html | 8 | ||||
-rw-r--r-- | app/templates/modules/catalog.html | 35 | ||||
-rw-r--r-- | app/templates/modules/creator.html | 8 | ||||
-rw-r--r-- | app/templates/modules/logger.html | 8 | ||||
-rw-r--r-- | app/templates/modules/stock.html | 8 |
9 files changed, 177 insertions, 0 deletions
diff --git a/app/templates/add_product.html b/app/templates/add_product.html new file mode 100644 index 0000000..ad7ea0a --- /dev/null +++ b/app/templates/add_product.html @@ -0,0 +1,44 @@ +{# -*- mode: jinja2; -*- #} + +{% extends "base.html" %} +{% import "bootstrap/wtf.html" as wtf %} + +{% block content %} + + {% block title %}Add a New Product{% endblock %} + + {% if message %} + + {# the form was submitted and message exists #} + <p class="lead"><strong>{{ message }}</strong></p> + {# links #} + <p><a href="{{ url_for('add_product') }}" class="button">Submit another product.</a></p> +<p><a href="/fapg/home">Return to the index.</a></p> + +{% else %} + + {# the form is displayed when template opens via GET not POST #} + <p class="lead alert alert-primary">Add a new sock to our inventory.</p> +<p class="ml-4"><a href="/fapg/home" class="button">Return to the index.</a></p> +{# show flash - based on WTForms validators +see https://pythonprogramming.net/flash-flask-tutorial/ +get_flashed_messages() exists here because of flash() +in the route function +#} +{% with errors = get_flashed_messages() %} + {% if errors %} + {% for err in errors %} + <div class="alert alert-danger alert-dismissible" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button> + {{ err }} + </div> + {% endfor %} + {% endif %} +{% endwith %} +{# end of flash #} + +{# the form, thanks to WTForms #} +{{ wtf.quick_form(form) }} + +{% endif %} +{% endblock %} diff --git a/app/templates/base.html b/app/templates/base.html new file mode 100644 index 0000000..0b53b5c --- /dev/null +++ b/app/templates/base.html @@ -0,0 +1,30 @@ +{# -*- mode: jinja2; -*- #} + +<!doctype html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to"> + <title>Farm Manager</title> + <meta name="author" content="Marius Peter"> + <meta name="description" content="A draft page for Farm Manager."> + <!-- <link rel="icon" href="/favicon.ico"> --> + <link rel="stylesheet" href="{{ url_for('static', filename='styles/style.css') }}"> + </head> + <body> + <nav> + <a href="/" class="button">Home</a> + <h1>{% block title %}{% endblock %}</h1> + <ul> + {% for module in modules %} + <li><a href="/module/{{ module.name }}" class="button">{{ module.name }}</a></li> + {% endfor %} + </ul> + </nav> + <div id="content"> + {% block content %}{% endblock %} + </div> + <!-- <script src="js/scripts.js"></script> --> + </body> +</html> diff --git a/app/templates/errors/module-not-found.html b/app/templates/errors/module-not-found.html new file mode 100644 index 0000000..6496503 --- /dev/null +++ b/app/templates/errors/module-not-found.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + +{% block title %} +Module not found +{% endblock %} + +{% block content %} +<p> + No module found with name <strong>{{ module }}</strong>. +</p> +<p> + If you'd like to suggest a module, please send us an e-mail +</p> +{% endblock %} diff --git a/app/templates/home.html b/app/templates/home.html new file mode 100644 index 0000000..a9bac51 --- /dev/null +++ b/app/templates/home.html @@ -0,0 +1,22 @@ +<!-- -*- mode: jinja2; -*- --> + +{% extends "base.html" %} + +{% block title %} + Welcome, {{ user.name_first }}! +{% endblock %} + + +{% block content %} + + <p>You are logged in as <strong>{{ user }}</strong> on + project <strong>{{ project }}</strong>.</p> + + <h2>Available modules</h2> + <dl> + {% for module in modules %} + <dt style="font-weight: bold">{{ module.name }}</dt><dd>{{ module.description }}<dd> + {% endfor %} + </dl> + +{% endblock %} diff --git a/app/templates/modules/calculator.html b/app/templates/modules/calculator.html new file mode 100644 index 0000000..f951a17 --- /dev/null +++ b/app/templates/modules/calculator.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block title %} +Calculator +{% endblock %} + +{% block content %} +<i>insert module content here.</i> +{% endblock %} diff --git a/app/templates/modules/catalog.html b/app/templates/modules/catalog.html new file mode 100644 index 0000000..857c654 --- /dev/null +++ b/app/templates/modules/catalog.html @@ -0,0 +1,35 @@ +<!-- -*- mode: jinja2; -*- --> + +{% extends "base.html" %} +{% block title %} + Catalog +{% endblock %} + +{% block content %} + <i>insert module content here.</i> + + <p> + <a href="{{ url_for('add_product') }}" class="button">Add product to your catalog</a> + </p> + + <table> + <thead> + <tr> + <th>Name</th> + <th>Price</th> + <th>Supplier</th> + <th>Updated</th> + </tr> + </thead> + <tbody> + {% for product in catalog %} + <tr> + <td>{{ product.name }}</td> + <td>{{ product.price }}</td> + <td>{{ product.supplier }}</td> + <td>{{ product.updated }}</td> + </tr> + {% endfor %} + </tbody> + </table> +{% endblock %} diff --git a/app/templates/modules/creator.html b/app/templates/modules/creator.html new file mode 100644 index 0000000..588f428 --- /dev/null +++ b/app/templates/modules/creator.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block title %} +Creator +{% endblock %} + +{% block content %} +<i>insert module content here.</i> +{% endblock %} diff --git a/app/templates/modules/logger.html b/app/templates/modules/logger.html new file mode 100644 index 0000000..7ba93b3 --- /dev/null +++ b/app/templates/modules/logger.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block title %} +Logger +{% endblock %} + +{% block content %} +<i>insert module content here.</i> +{% endblock %} diff --git a/app/templates/modules/stock.html b/app/templates/modules/stock.html new file mode 100644 index 0000000..5d20d5c --- /dev/null +++ b/app/templates/modules/stock.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% block title %} +Stock +{% endblock %} + +{% block content %} +<i>insert module content here.</i> +{% endblock %} |