mirror of
http://git.carcosa.net/jmcbray/brutaldon.git
synced 2024-11-23 07:13:52 -05:00
Add support for basic threading.
It works the same as the Mastodon web UI for now - active toot is highlighted, ancestors displayed in order above, descendants in order below. I hope to add actual full threading one day.
This commit is contained in:
parent
af30107368
commit
2e7fc810ac
@ -8,3 +8,7 @@ img.fav-avatar {
|
||||
display: inline;
|
||||
|
||||
}
|
||||
|
||||
.box.active_context {
|
||||
background-color: #FFF8DC;
|
||||
}
|
||||
|
@ -192,3 +192,6 @@ img {
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
.box.active_context {
|
||||
background-color: #DDD;
|
||||
}
|
||||
|
34
brutaldon/templates/main/thread.html
Normal file
34
brutaldon/templates/main/thread.html
Normal file
@ -0,0 +1,34 @@
|
||||
{% extends "base.html" %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}
|
||||
Brutaldon - thread
|
||||
{% endblock %}
|
||||
|
||||
{% comment %}
|
||||
mastodon.status_context(<numerical id>)
|
||||
# Returns the following dictionary:
|
||||
{
|
||||
'ancestors': # A list of toot dicts
|
||||
'descendants': # A list of toot dicts
|
||||
}
|
||||
{% endcomment %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="title">Thread</h1>
|
||||
{% for ancestor in context.ancestors %}
|
||||
<div class="box">
|
||||
{% include "main/toot_partial.html" with toot=ancestor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="box active_context">
|
||||
{% include "main/toot_partial.html" with toot=toot %}
|
||||
</div>
|
||||
{% for descendant in context.descendants %}
|
||||
<div class="box">
|
||||
{% include "main/toot_partial.html" with toot=descendant %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
{% endblock %}
|
@ -81,7 +81,7 @@
|
||||
<span class="level-item">
|
||||
{{ toot.visibility }}
|
||||
</span>
|
||||
<a class="level-item" >
|
||||
<a class="level-item" href="{% url "thread" toot.id %}">
|
||||
thread
|
||||
</a>
|
||||
</div>
|
||||
|
@ -27,5 +27,6 @@ urlpatterns = [
|
||||
path('local', views.local, name='local'),
|
||||
path('fed', views.fed, name='fed'),
|
||||
path('settings', views.settings, name='settings'),
|
||||
path('thread/<int:id>', views.thread, name='thread'),
|
||||
path('', views.home),
|
||||
]
|
||||
|
@ -120,6 +120,14 @@ def note(request):
|
||||
{'notes': notes,'timeline': 'Notifications',
|
||||
'fullbrutalism': fullbrutalism_p(request)})
|
||||
|
||||
def thread(request, id):
|
||||
mastodon = get_mastodon(request)
|
||||
context = mastodon.status_context(id)
|
||||
toot = mastodon.status(id)
|
||||
return render(request, 'main/thread.html',
|
||||
{'context': context, 'toot': toot,
|
||||
'fullbrutalism': fullbrutalism_p(request)})
|
||||
|
||||
|
||||
def settings(request):
|
||||
if request.method == 'POST':
|
||||
|
Loading…
Reference in New Issue
Block a user