Skip to content

Commit 8607465

Browse files
committed
Refactor notes view
- Display user profile picture alongside comments - Prevent overflow of long text comments - Fix the size of the input text area - Use Gravatar for user profile pictures - Bug fix: Show correct update time for comments Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 2aedfeb commit 8607465

1 file changed

Lines changed: 51 additions & 39 deletions

File tree

fedcode/templates/note.html

Lines changed: 51 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,98 @@
11
{% extends "base.html" %}
22
{% load static %}
33
{% load webfinger_image %}
4+
45
{% block title %}
56
Note page
67
{% endblock %}
7-
{% block extra-head %}
8-
<script src="{% static 'js/vote.js' %}"></script>
8+
9+
{% block scripts %}
10+
<script src="{% static 'js/vote.js' %}" defer></script>
911
{% endblock %}
12+
1013
{% block content %}
1114
<div class="columns">
1215
<div class="column">
1316
</div>
14-
<div class="column is-four-fifths box">
17+
<div class="column is-four-fifths box px-6 py-6">
1518

1619
<article class="media">
1720
<figure class="media-left">
1821
<p class="image is-64x64">
19-
<img src="{{ note.acct | get_pkg_image }}" alt="purl-image">
22+
<img src="{{ note.acct | get_pkg_image }}" alt="purl-image">
2023
</p>
2124
</figure>
2225
<form class="ml-5 mr-5" name="vote-notes">
23-
<span class="icon ml-1">
24-
<button name="vote-up" class="button is-rounded is-white" value="{{ note.id }}" type="submit"></button>
25-
</span>
26-
<p class="ml-3 mt-1 mb-1" name="{{ note.id }}">{{ note.reputation_value }}</p>
27-
<span class="icon ml-1">
28-
<button name="vote-down" class="button is-rounded is-white" value="{{ note.id }}" type="submit"></button>
29-
</span>
26+
<span class="icon ml-1">
27+
<button name="vote-up" class="button is-rounded is-white" value="{{ note.id }}" type="submit"></button>
28+
</span>
29+
<p class="ml-3 mt-1 mb-1" name="{{ note.id }}">{{ note.reputation_value }}</p>
30+
<span class="icon ml-1">
31+
<button name="vote-down" class="button is-rounded is-white" value="{{ note.id }}" type="submit"></button>
32+
</span>
3033
</form>
3134

3235
<div class="media-content">
3336
<div class="content">
3437
<p>
3538
<a href="{% url 'purl-profile' note.username %}">{{ note.acct }}</a>
3639
<br>
37-
<pre class="has-text-black">{{ note.content }}</pre>
40+
<pre class="has-text-black">{{ note.content }}</pre>
3841
</p>
3942
</div>
4043
</div>
4144

4245
<div class="media-right">
43-
<small>last update: {{ note.updated_at }}</small>
46+
<small>last update: {{ note.updated_at }}</small>
4447
</div>
4548
</article>
4649

4750
{% for note_r in note.replies.all %}
48-
<article class="media ml-5">
49-
<div class="media-content">
50-
<div class="content">
51-
<p>
52-
<a href="{% url 'user-profile' note_r.username %}">@{{ note_r.acct }}</a>
53-
<p>{{ note_r.content }}</p>
54-
</p>
55-
</div>
56-
</div>
57-
<div class="media-right">
58-
<small>last update: {{ note.updated_at }}</small>
59-
</div>
60-
</article>
51+
<article class="media">
52+
<figure class="media-left">
53+
<p class="image is-64x64">
54+
<img class="is-rounded" src="{{ note_r.acct_avatar }}">
55+
</p>
56+
</figure>
57+
<div class="media-content">
58+
<div class="content">
59+
<p>
60+
<a href="{% url 'user-profile' note_r.username %}">@{{ note_r.acct }}</a>
61+
<p class="title is-6 has-text-weight-normal">{{ note_r.content }}</p>
62+
</p>
63+
</div>
64+
</div>
65+
<div class="media-right">
66+
<small>last update: {{ note_r.updated_at }}</small>
67+
</div>
68+
</article>
6169
{% endfor %}
6270

6371
<article class="media">
6472

6573
<figure class="media-left">
6674
<p class="image is-64x64">
67-
<img class="is-rounded" src="{{ user.person.avatar.url }}" >
75+
<img class="is-rounded" src="{{ user.person.avatar }}">
6876
</p>
6977
</figure>
7078
<div class="media-content">
71-
<form method="POST" action="">
72-
<div class="field">
73-
<p class="control">
74-
{% csrf_token %}
75-
{{ form }}
76-
</p>
77-
</div>
78-
<div class="field">
79-
<p class="control">
80-
<button class="button" type="submit">Post comment</button>
81-
</p>
79+
<form method="POST" action="">
80+
<div class="field">
81+
<p class="control">
82+
{% csrf_token %}
83+
<div class="columns">
84+
<div class="column is-three-quarters">
85+
{{ form }}
86+
</div>
8287
</div>
83-
</form>
88+
</p>
89+
</div>
90+
<div class="field">
91+
<p class="control">
92+
<button class="button is-info" type="submit">Post comment</button>
93+
</p>
94+
</div>
95+
</form>
8496
</div>
8597
</article>
8698
</div>

0 commit comments

Comments
 (0)