Add post count data to profile, add more precise timestamp titles, remove likes placeholder

This commit is contained in:
Xevion
2022-03-27 11:21:20 -05:00
parent e01dbf4e16
commit cd590596bc
2 changed files with 29 additions and 24 deletions

View File

@@ -33,6 +33,8 @@ class User(UserMixin, db.Model):
delta: datetime.timedelta = datetime.datetime.utcnow() - self.time_registered
return humanize.naturaldelta(delta)
def get_post_count(self) -> int:
return len(self.posts)
class Post(db.Model):
id = db.Column(db.Integer, primary_key=True)

View File

@@ -7,17 +7,20 @@
{% if seen_text == 'Online now!' %}
<span class="profile-timestamp online">{{ seen_text }}</span>
{% else %}
<span class="profile-timestamp offline">{{ seen_text }}</span>
<span class="profile-timestamp offline" title="{{ user.last_seen }}">{{ seen_text }}</span>
{% endif %}
{% endwith %}
</div>
<div class="profile-lower">
<div class="profile-left">
<img class="profile-picture" src="{{ url_for('static', filename='default_photo.png') }}" alt="{{ user.username }}'s Profile Picture">
<img class="profile-picture" src="{{ url_for('static', filename='default_photo.png') }}"
alt="{{ user.username }}'s Profile Picture">
<div class="profile-details">
Registered {{ user.get_registration_delta() }} ago<br>
0 likes<br>
0 posts<br>
<span title="{{ user.time_registered }}">Registered {{ user.get_registration_delta() }} ago</span><br>
{# 0 likes<br>#}
{% with post_count = user.get_post_count() %}
{{ post_count }} post{% if post_count > 1 %}s{% endif %}<br>
{% endwith %}
</div>
</div>
<div class="profile-bio">