From 54dd4a04924729b6b31d794e98552773eb1383a8 Mon Sep 17 00:00:00 2001 From: Holger Frey Date: Mon, 16 Oct 2017 15:28:49 +0200 Subject: [PATCH] added public (static) pages --- ordr2/static/style.css | 11 +++-- ordr2/templates/layout.jinja2 | 10 ++-- ordr2/templates/mytemplate.jinja2 | 10 ---- ordr2/templates/pages/faq.jinja2 | 73 ++++++++++++++++++++++++++++ ordr2/templates/pages/welcome.jinja2 | 33 +++++++++++++ ordr2/views/pages.py | 24 +++++++++ ordr2/views/public.py | 13 ----- tests/views/pages.py | 20 ++++++++ tests/views/public.py | 10 ---- 9 files changed, 161 insertions(+), 43 deletions(-) delete mode 100644 ordr2/templates/mytemplate.jinja2 create mode 100644 ordr2/templates/pages/faq.jinja2 create mode 100644 ordr2/templates/pages/welcome.jinja2 create mode 100644 ordr2/views/pages.py delete mode 100644 ordr2/views/public.py create mode 100644 tests/views/pages.py delete mode 100644 tests/views/public.py diff --git a/ordr2/static/style.css b/ordr2/static/style.css index 7f58ef0..d883b4c 100644 --- a/ordr2/static/style.css +++ b/ordr2/static/style.css @@ -10,10 +10,15 @@ header .btn-toolbar .btn-group { margin-right:1em; } -.container-fluid { - padding-top: 1em; +main { + padding-top: 2em; } -.list-group-header { +.o2-faqs h1, .o2-faqs h2 { + margin-bottom:1rem; + } + +.o2-faqs h3 { + margin-top:2rem; } diff --git a/ordr2/templates/layout.jinja2 b/ordr2/templates/layout.jinja2 index c1ca956..735149d 100644 --- a/ordr2/templates/layout.jinja2 +++ b/ordr2/templates/layout.jinja2 @@ -54,13 +54,9 @@
-
- - {% block content %} -

No content

- {% endblock content %} - -
+ {% block content %} +

No content

+ {% endblock content %}
diff --git a/ordr2/templates/mytemplate.jinja2 b/ordr2/templates/mytemplate.jinja2 deleted file mode 100644 index 1dc103c..0000000 --- a/ordr2/templates/mytemplate.jinja2 +++ /dev/null @@ -1,10 +0,0 @@ -{% extends "layout.jinja2" %} - -{% block title %} ordr | Welcome {% endblock title%} - -{% block content %} -
-

Pyramid Alchemy project

-

Welcome to Ordr2, a Pyramid application generated by
Cookiecutter.

-
-{% endblock content %} diff --git a/ordr2/templates/pages/faq.jinja2 b/ordr2/templates/pages/faq.jinja2 new file mode 100644 index 0000000..4a2ba24 --- /dev/null +++ b/ordr2/templates/pages/faq.jinja2 @@ -0,0 +1,73 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block title %} Ordr | FAQ {% endblock title %} + +{% block content %} +
+
+

Frequently Asked Questions

+ +
+ +
+ +

Account

+

+ Why can't I log in? It always says: "You entered the wrong unsername and/or password." +

+

+ First of all, just because ordr tells you that you have entered a wrong username or password doesn't mean that's necesseraily true. Sound dumb? But actually this is a security measure, which helps against brood force attacks because the adversary doesn't know if the username he guessed was correct or not. +

+

+ Usually there are two common reasons why you can't log in. There are: +

+
    +
  1. Your account hasn't been activated by an admin yet. – In this case ask a admin if he already has activated your account.
  2. +
  3. You mistyped your password or username. – Just try it another time and make sure caps log isn't activated.
  4. +
+ +

+ Why can't I choose my own username? +

+

+ We want to enforce a specific guideline for the username. Namely first name followed immediately by the last name. This way everyone can easily identify the person, who placed an order. So please enter your real name into the registration form. Otherwise your account may not been activated because no one knows who you are. +

+ +

+ Why can I only edit my email after I registered? +

+

+ Your username depends on your first and last name. Changing the username is not allowed, therefore you are also not allowed to change your first and last name afterwards. Even admins can not change your first/last name and your username. +

+
+ +
+

Ordering

+ +
+

+ I have an consumable, which I am ordering regulary but isn't in the databse. Can I add it? +

+

+ Unfortunately you can not add consumables to the databse yourself. But ask an admin or purchaser. They're certainly to help you out. +

+
+
+ +
+

Miscellaneous

+ +
+

+ I have found a bug where can I report it? +

+

+ If you have found a bug or an issue with the software please use this page here. + You need an gogs account to submit an issue. Please be as specific as you can be. +

+
+
+
+
+
+{% endblock content %} diff --git a/ordr2/templates/pages/welcome.jinja2 b/ordr2/templates/pages/welcome.jinja2 new file mode 100644 index 0000000..37816d5 --- /dev/null +++ b/ordr2/templates/pages/welcome.jinja2 @@ -0,0 +1,33 @@ +{% extends "ordr2:templates/layout.jinja2" %} + +{% block title %} Ordr | Welcome {% endblock title %} + +{% block content %} +
+
+ +
+

Welcome to ordr!

+

An order management system to simplify your shopping for laboratory supplies.

+

+ What can order do for you? It will simplify the process of ordering laboratory supplies by using the power of the newest web technologies. Interested? Just follow the three steps below! +

+
+ +
+
+

1. Register

+

Registration is easy as 1-2-3. Just fill out the form on and as soon as an admin has activated your account the shopping can begin!

+
+
+

2. Place an Order

+

A lot of the chemicals, supllies and so forth are already stored in the database, so you don't have to fill out the order form your self!

+
+
+

3. Get notified

+

As soons as your purchase has arrived you will automatically get notified. Or you can use the orders overview to check what the working status is.

+
+
+
+
+{% endblock content %} diff --git a/ordr2/views/pages.py b/ordr2/views/pages.py new file mode 100644 index 0000000..ed75665 --- /dev/null +++ b/ordr2/views/pages.py @@ -0,0 +1,24 @@ +''' simple pages ''' + +from pyramid.view import view_config + + +@view_config( + context='ordr2:resources.RootResource', + permission='view', + renderer='ordr2:templates/pages/welcome.jinja2' + ) +def welcome(context, request): + ''' the welcome page ''' + return {} + + +@view_config( + context='ordr2:resources.RootResource', + name='faq', + permission='view', + renderer='ordr2:templates/pages/faq.jinja2' + ) +def faq(context, request): + ''' the faq page ''' + return {} diff --git a/ordr2/views/public.py b/ordr2/views/public.py deleted file mode 100644 index e86b79f..0000000 --- a/ordr2/views/public.py +++ /dev/null @@ -1,13 +0,0 @@ -''' pubic accessible views ''' - -from pyramid.view import view_config - - -@view_config( - context='ordr2:resources.RootResource', - permission='view', - renderer='ordr2:templates/mytemplate.jinja2' - ) -def index(context, request): - ''' the start page ''' - return {} diff --git a/tests/views/pages.py b/tests/views/pages.py new file mode 100644 index 0000000..cfba5b3 --- /dev/null +++ b/tests/views/pages.py @@ -0,0 +1,20 @@ +''' Tests for ordr2.views.public ''' + + +def test_welcome_view(): + ''' test the default view for a root resource ''' + from ordr2.views.pages import welcome + + result = welcome(None, None) + + assert result == {} + + + +def test_faq_view(): + ''' test the default view for a root resource ''' + from ordr2.views.pages import faq + + result = faq(None, None) + + assert result == {} diff --git a/tests/views/public.py b/tests/views/public.py deleted file mode 100644 index e608bd2..0000000 --- a/tests/views/public.py +++ /dev/null @@ -1,10 +0,0 @@ -''' Tests for ordr2.views.public ''' - - -def test_index_view(): - ''' test the default view for a root resource ''' - from ordr2.views.public import index - - result = index(None, None) - - assert result == {}