diff options
Diffstat (limited to 'sw/templates')
| -rw-r--r-- | sw/templates/base.html | 20 | ||||
| -rw-r--r-- | sw/templates/base.json | 4 | ||||
| -rw-r--r-- | sw/templates/get_user_inbox.html | 11 | ||||
| -rw-r--r-- | sw/templates/get_user_inbox.json | 11 | ||||
| -rw-r--r-- | sw/templates/get_user_inbox_page.html | 13 | ||||
| -rw-r--r-- | sw/templates/get_user_inbox_page.json | 16 | ||||
| -rw-r--r-- | sw/templates/get_user_outbox.html | 11 | ||||
| -rw-r--r-- | sw/templates/get_user_outbox.json | 9 | ||||
| -rw-r--r-- | sw/templates/get_user_outbox_page.html | 13 | ||||
| -rw-r--r-- | sw/templates/get_user_outbox_page.json | 16 | ||||
| -rw-r--r-- | sw/templates/index.html | 9 | ||||
| -rw-r--r-- | sw/templates/user_info.html | 13 | ||||
| -rw-r--r-- | sw/templates/user_info.json | 11 |
13 files changed, 157 insertions, 0 deletions
diff --git a/sw/templates/base.html b/sw/templates/base.html new file mode 100644 index 0000000..4f2acf1 --- /dev/null +++ b/sw/templates/base.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>{% block title %}{% endblock %}</title> +<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"> +<nav> + <ul> + {% if g.user %} + <li><span>{{ g.user['username'] }}</span></li> + <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> + {% endif %} + </ul> +</nav> +<section class="content"> + <header> + {% block header %}{% endblock %} + </header> + {% block content %}{% endblock %} +</section> diff --git a/sw/templates/base.json b/sw/templates/base.json new file mode 100644 index 0000000..e0a0876 --- /dev/null +++ b/sw/templates/base.json @@ -0,0 +1,4 @@ +{ +{% block content %}{% endblock %} +"@context": "https://www.w3.org/ns/activitystreams" +} diff --git a/sw/templates/get_user_inbox.html b/sw/templates/get_user_inbox.html new file mode 100644 index 0000000..7956a21 --- /dev/null +++ b/sw/templates/get_user_inbox.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block header %} +<h1>{% block title %}{{ user["username"] }}'s Inbox }}{% endblock %}</h1> +{% endblock %} + +{% block content %} +<p>{{ user["inbox_size"] }} items</p> +<p><a href="{{ url_for('.get_user_inbox_page', username=user['username']) }}">First page</a></p> +<p><a href="{{ url_for('.get_user_inbox_page', username=user['username'], min_id=1) }}">Last page</a></p> +{% endblock %} diff --git a/sw/templates/get_user_inbox.json b/sw/templates/get_user_inbox.json new file mode 100644 index 0000000..c186fae --- /dev/null +++ b/sw/templates/get_user_inbox.json @@ -0,0 +1,11 @@ +{% extends "base.json" %} + +{% block content %} +"type": "OrderedCollection", + +"id": "{{ url_for('.get_user_inbox', username=user['username']) }}", + +"totalItems": {{ user['inbox_size'] }}, +"first": "{{ url_for('.get_user_inbox_page', username=user['username']) }}", +"last": "{{ url_for('.get_user_inbox_page', username=user['username'], min_id=1) }}", +{% endblock %} diff --git a/sw/templates/get_user_inbox_page.html b/sw/templates/get_user_inbox_page.html new file mode 100644 index 0000000..a331049 --- /dev/null +++ b/sw/templates/get_user_inbox_page.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block header %} +<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> +{% endblock %} diff --git a/sw/templates/get_user_inbox_page.json b/sw/templates/get_user_inbox_page.json new file mode 100644 index 0000000..50a9f06 --- /dev/null +++ b/sw/templates/get_user_inbox_page.json @@ -0,0 +1,16 @@ +{% extends "base.json" %} + +{% block content %} +"type": "OrderedCollectionPage", + +"id": "{{ url_for('.get_user_inbox_page', username=user['username'], max_id=max_id) }}", + +{% 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": {{ items }}, +{% endblock %} diff --git a/sw/templates/get_user_outbox.html b/sw/templates/get_user_outbox.html new file mode 100644 index 0000000..9f4d893 --- /dev/null +++ b/sw/templates/get_user_outbox.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block header %} +<h1>{% block title %}{{ user["username"] }}'s Outbox }}{% endblock %}</h1> +{% endblock %} + +{% block content %} +<p>{{ user["outbox_size"] }} items</p> +<p><a href="{{ url_for('.get_user_outbox_page', username=user['username']) }}">First page</a></p> +<p><a href="{{ url_for('.get_user_outbox_page', username=user['username'], min_id=1) }}">Last page</a></p> +{% endblock %} diff --git a/sw/templates/get_user_outbox.json b/sw/templates/get_user_outbox.json new file mode 100644 index 0000000..ce2fad4 --- /dev/null +++ b/sw/templates/get_user_outbox.json @@ -0,0 +1,9 @@ +{% extends "base.json" %} + +{% block content %} +"id": "{{ url_for('.get_user_inbox', username=user['username']) }}", +"type": "OrderedCollection", + +"totalItems": "{{ user['outbox_size'] }}", +"first": "{{ url_for('.get_user_outbox_page', username=user['username']) }}", +{% endblock %} diff --git a/sw/templates/get_user_outbox_page.html b/sw/templates/get_user_outbox_page.html new file mode 100644 index 0000000..2907604 --- /dev/null +++ b/sw/templates/get_user_outbox_page.html @@ -0,0 +1,13 @@ +{% extends "base.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 new file mode 100644 index 0000000..b25a5ce --- /dev/null +++ b/sw/templates/get_user_outbox_page.json @@ -0,0 +1,16 @@ +{% extends "base.json" %} + +{% block content %} +"type": "OrderedCollecdtionPage", + +"id": "{{ url_for('.get_user_outbox_page', username=user['username'], max_id=max_id) }}", + +{% 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": {{ items }}, +{% endblock %} diff --git a/sw/templates/index.html b/sw/templates/index.html new file mode 100644 index 0000000..12e9e79 --- /dev/null +++ b/sw/templates/index.html @@ -0,0 +1,9 @@ +{% extends "base.html" %} + +{% block header %} +<h1>{% block title %}Register{% endblock %}</h1> +{% endblock %} + +{% block content %} +Hello, World! +{% endblock %} diff --git a/sw/templates/user_info.html b/sw/templates/user_info.html new file mode 100644 index 0000000..96c3d2f --- /dev/null +++ b/sw/templates/user_info.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block header %} +<h1>{% block title %}User {{ user["username"] }}{% endblock %}</h1> +{% endblock %} + +{% block content %} +<p>username: {{ user["username"] }}</p> +<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> +{% endblock %} diff --git a/sw/templates/user_info.json b/sw/templates/user_info.json new file mode 100644 index 0000000..a14d6bc --- /dev/null +++ b/sw/templates/user_info.json @@ -0,0 +1,11 @@ +{% extends "base.json" %} + +{% block content %} +"type": "Actor", + +"name": "{{ user['username'] }}", +"id": "{{ url_for('users.get_user_info', username=user['username']) }}", + +"inbox": "{{ url_for('users.get_user_inbox', username=user['username']) }}", +"outbox": "{{ url_for('users.get_user_outbox', username=user['username']) }}", +{% endblock %} |
