diff options
| author | Tom Harley | 2021-07-31 14:06:45 +0000 |
|---|---|---|
| committer | Tom Harley | 2021-07-31 19:30:35 +0000 |
| commit | 68703447d8fc57c7b77b66a6acc05bf22fb7d71b (patch) | |
| tree | 715006453d66889e210fd41f17aff9153f9a5092 /sw/templates | |
| parent | Add templates (diff) | |
| download | swap-68703447d8fc57c7b77b66a6acc05bf22fb7d71b.tar.gz swap-68703447d8fc57c7b77b66a6acc05bf22fb7d71b.zip | |
Display inbox/outbox contents correctly
As per previous commit, the contents of inboxes and outboxes were not being properly displayed, which was difficult to test because of there being very few items in the test DB.
This commit includes moving functions such as prepared_output into a new file sw/util.py; including them in sw/users.py made little sense and caused a circular dependency with sw/auth.py.
A stub function for item info retreival has also been created, in new file sw/items.py.
Diffstat (limited to 'sw/templates')
| -rw-r--r-- | sw/templates/base.html | 2 | ||||
| -rw-r--r-- | sw/templates/get_user_inbox_page.json | 6 | ||||
| -rw-r--r-- | sw/templates/get_user_outbox_page.json | 6 | ||||
| -rw-r--r-- | sw/templates/login.html | 14 |
4 files changed, 25 insertions, 3 deletions
diff --git a/sw/templates/base.html b/sw/templates/base.html index 4f2acf1..2917e0f 100644 --- a/sw/templates/base.html +++ b/sw/templates/base.html @@ -8,7 +8,7 @@ <li><a href="{{ url_for('auth.logout') }}">Log Out</a></li> {% else %} <li><a href="{{ url_for('auth.register') }}">Register</a></li> - <li><a href="{{ url_for('auth.login') }}">Log In</a></li> + <li><a href="{{ url_for('auth.get_login') }}">Log In</a></li> {% endif %} </ul> </nav> diff --git a/sw/templates/get_user_inbox_page.json b/sw/templates/get_user_inbox_page.json index 50a9f06..96bf9e8 100644 --- a/sw/templates/get_user_inbox_page.json +++ b/sw/templates/get_user_inbox_page.json @@ -12,5 +12,9 @@ "current": "{{ url_for('.get_user_inbox_page', username=user['username']) }}", "partOf": "{{ url_for('.get_user_inbox', username=user['username']) }}", -"items": {{ items }}, +"items": [ + {% for item in items %} + "{{ item }}"{{ ',' if not loop.last }} + {% endfor %} +], {% endblock %} diff --git a/sw/templates/get_user_outbox_page.json b/sw/templates/get_user_outbox_page.json index b25a5ce..2f3936f 100644 --- a/sw/templates/get_user_outbox_page.json +++ b/sw/templates/get_user_outbox_page.json @@ -12,5 +12,9 @@ "current": "{{ url_for('.get_user_outbox_page', username=user['username']) }}", "partOf": "{{ url_for('.get_user_outbox', username=user['username']) }}", -"items": {{ items }}, +"items": [ + {% for item in items %} + "{{ item }}"{{ "," if not loop.last }} + {% endfor %} +], {% endblock %} diff --git a/sw/templates/login.html b/sw/templates/login.html new file mode 100644 index 0000000..87cd386 --- /dev/null +++ b/sw/templates/login.html @@ -0,0 +1,14 @@ +{% extends "base.html" %} + + +{% block header %}{% block title %}Log In{% endblock %}{% endblock %} + +{% block content %} +<form action="{{ url_for('.get_login') }}"> + <label for="username">Username:</label><br> + <input type="text" id="username" name="username"><br> + <label for="password">Password:</label><br> + <input type="password" id="password" name="password"><br> + <input type="submit" value="Log in"> +</form> +{% endblock %} |
