summaryrefslogtreecommitdiff
path: root/sw/templates
diff options
context:
space:
mode:
Diffstat (limited to 'sw/templates')
-rw-r--r--sw/templates/ap/collection_page.html19
-rw-r--r--sw/templates/ap/collection_page.json23
-rw-r--r--sw/templates/ap/ordered_collection_page.html1
-rw-r--r--sw/templates/ap/ordered_collection_page.json5
-rw-r--r--sw/templates/base.json6
-rw-r--r--sw/templates/get_user_inbox_page.html16
-rw-r--r--sw/templates/get_user_inbox_page.json21
-rw-r--r--sw/templates/get_user_outbox_page.html10
-rw-r--r--sw/templates/get_user_outbox_page.json15
-rw-r--r--sw/templates/user_info.html3
10 files changed, 78 insertions, 41 deletions
diff --git a/sw/templates/ap/collection_page.html b/sw/templates/ap/collection_page.html
new file mode 100644
index 0000000..dc209d0
--- /dev/null
+++ b/sw/templates/ap/collection_page.html
@@ -0,0 +1,19 @@
+{% extends "base.html" %}
+
+{% block content %}
+
+{% block items %}
+<ol>
+ {% for item in items %}
+ {% block item_info scoped %}
+ <li value="{{ item.id }}">
+ <a href="{{ url_for('items.get_item_info', item_id=item.id) }}">
+ {{ item.summary or item.name or "unknown item" }}
+ </a>
+ </li>
+ {% endblock %}
+ {% endfor %}
+</ol>
+{% endblock %}
+
+{% endblock %}
diff --git a/sw/templates/ap/collection_page.json b/sw/templates/ap/collection_page.json
new file mode 100644
index 0000000..e3bfe3b
--- /dev/null
+++ b/sw/templates/ap/collection_page.json
@@ -0,0 +1,23 @@
+{% extends "base.json" %}
+
+{% block content %}
+
+ {% block type %}
+ "type": "CollectionPage",
+ {% endblock %}
+
+ {% block nav %}
+ {% endblock %}
+
+ {% block items %}
+ "items": [
+ {% for item in items %}
+ {% block item_info scoped %}
+ "{{ url_for('items.get_item_info', item_id=item['id']) }}"
+ {% endblock %}
+ {{- "," if not loop.last }}
+ {% endfor %}
+ ],
+ {% endblock %}
+
+{% endblock %}
diff --git a/sw/templates/ap/ordered_collection_page.html b/sw/templates/ap/ordered_collection_page.html
new file mode 100644
index 0000000..57ed54b
--- /dev/null
+++ b/sw/templates/ap/ordered_collection_page.html
@@ -0,0 +1 @@
+{% extends "ap/collection_page.html" %}
diff --git a/sw/templates/ap/ordered_collection_page.json b/sw/templates/ap/ordered_collection_page.json
new file mode 100644
index 0000000..1a97b4a
--- /dev/null
+++ b/sw/templates/ap/ordered_collection_page.json
@@ -0,0 +1,5 @@
+{% extends "ap/collection_page.json" %}
+
+{% block type %}
+"type": "OrderedCollectionPage",
+{% endblock %}
diff --git a/sw/templates/base.json b/sw/templates/base.json
index e0a0876..58da7f8 100644
--- a/sw/templates/base.json
+++ b/sw/templates/base.json
@@ -1,4 +1,8 @@
{
-{% block content %}{% endblock %}
+{% block content %}
+{% endblock %}
+
+{% block context %}
"@context": "https://www.w3.org/ns/activitystreams"
+{% endblock %}
}
diff --git a/sw/templates/get_user_inbox_page.html b/sw/templates/get_user_inbox_page.html
index a331049..a839015 100644
--- a/sw/templates/get_user_inbox_page.html
+++ b/sw/templates/get_user_inbox_page.html
@@ -1,13 +1,13 @@
-{% extends "base.html" %}
+{% extends "ap/ordered_collection_page.html" %}
{% block header %}
-<h1>{% block title %}{{ user["username"] }}'s Inbox {% endblock %}</h1>
+<h1>{% block title %}{{ user["username"] }}'s Inbox{% endblock %}</h1>
{% endblock %}
-{% block content %}
-<ul>
-{% for item in items %}
-<li value="{{ items['id'] }}">{{ item }}</li>
-{% endfor %}
-</ul>
+{% block item_info scoped %}
+
+<li> <a href="{{ item }}">
+ {{ item }}
+</a> </li>
+
{% endblock %}
diff --git a/sw/templates/get_user_inbox_page.json b/sw/templates/get_user_inbox_page.json
index 96bf9e8..886aeda 100644
--- a/sw/templates/get_user_inbox_page.json
+++ b/sw/templates/get_user_inbox_page.json
@@ -1,20 +1,19 @@
-{% extends "base.json" %}
-
-{% block content %}
-"type": "OrderedCollectionPage",
+{% extends "ap/ordered_collection_page.json" %}
+{% block nav %}
"id": "{{ url_for('.get_user_inbox_page', username=user['username'], max_id=max_id) }}",
+"current": "{{ url_for('.get_user_inbox_page', username=user['username']) }}",
+"partOf": "{{ url_for('.get_user_inbox', username=user['username']) }}",
{% if items %}
"next": "{{ url_for('.get_user_inbox_page', username=user['username'], max_id=(min_id-1)) }}",
"prev": "{{ url_for('.get_user_inbox_page', username=user['username'], min_id=(max_id+1)) }}",
{% endif %}
-"current": "{{ url_for('.get_user_inbox_page', username=user['username']) }}",
-"partOf": "{{ url_for('.get_user_inbox', username=user['username']) }}",
-"items": [
- {% for item in items %}
- "{{ item }}"{{ ',' if not loop.last }}
- {% endfor %}
-],
+{% endblock %}
+
+{% block item_info scoped %}
+
+"{{ item }}"
+
{% endblock %}
diff --git a/sw/templates/get_user_outbox_page.html b/sw/templates/get_user_outbox_page.html
index 2907604..dfa60c2 100644
--- a/sw/templates/get_user_outbox_page.html
+++ b/sw/templates/get_user_outbox_page.html
@@ -1,13 +1,5 @@
-{% extends "base.html" %}
+{% extends "ap/ordered_collection_page.html" %}
{% block header %}
<h1>{% block title %}{{ user["username"] }}'s Outbox {% endblock %}</h1>
{% endblock %}
-
-{% block content %}
-<ul>
-{% for item in items %}
-<li value="{{ item['id'] }}">{{ item }}</li>
-{% endfor %}
-</ul>
-{% endblock %}
diff --git a/sw/templates/get_user_outbox_page.json b/sw/templates/get_user_outbox_page.json
index 2f3936f..8cdb93b 100644
--- a/sw/templates/get_user_outbox_page.json
+++ b/sw/templates/get_user_outbox_page.json
@@ -1,20 +1,13 @@
-{% extends "base.json" %}
-
-{% block content %}
-"type": "OrderedCollecdtionPage",
+{% extends "ap/ordered_collection_page.json" %}
+{% block nav %}
"id": "{{ url_for('.get_user_outbox_page', username=user['username'], max_id=max_id) }}",
+"current": "{{ url_for('.get_user_outbox_page', username=user['username']) }}",
+"partOf": "{{ url_for('.get_user_outbox', username=user['username']) }}",
{% if items %}
"next": "{{ url_for('.get_user_outbox_page', username=user['username'], max_id=(min_id-1)) }}",
"prev": "{{ url_for('.get_user_outbox_page', username=user['username'], min_id=(max_id+1)) }}",
{% endif %}
-"current": "{{ url_for('.get_user_outbox_page', username=user['username']) }}",
-"partOf": "{{ url_for('.get_user_outbox', username=user['username']) }}",
-"items": [
- {% for item in items %}
- "{{ item }}"{{ "," if not loop.last }}
- {% endfor %}
-],
{% endblock %}
diff --git a/sw/templates/user_info.html b/sw/templates/user_info.html
index 96c3d2f..557957a 100644
--- a/sw/templates/user_info.html
+++ b/sw/templates/user_info.html
@@ -9,5 +9,6 @@
<p>user ID: {{ user["id"] }}</p>
<p>no. of posts: {{ user["outbox_size"] }}</p>
<br>
-<p>inbox: <a href="{{ url_for('users.get_user_inbox', username=user["username"]) }}">{{ url_for('users.get_user_inbox', username=user["username"]) }}</a></p>
+<p><a href="{{ url_for('users.get_user_inbox', username=user["username"]) }}">Inbox</a></p>
+<p><a href="{{ url_for('users.get_user_outbox', username=user["username"]) }}">Outbox</a></p>
{% endblock %}