mirror of
https://github.com/Xevion/runnerspace.git
synced 2025-12-14 20:12:56 -06:00
Add post count data to profile, add more precise timestamp titles, remove likes placeholder
This commit is contained in:
@@ -33,6 +33,8 @@ class User(UserMixin, db.Model):
|
|||||||
delta: datetime.timedelta = datetime.datetime.utcnow() - self.time_registered
|
delta: datetime.timedelta = datetime.datetime.utcnow() - self.time_registered
|
||||||
return humanize.naturaldelta(delta)
|
return humanize.naturaldelta(delta)
|
||||||
|
|
||||||
|
def get_post_count(self) -> int:
|
||||||
|
return len(self.posts)
|
||||||
|
|
||||||
class Post(db.Model):
|
class Post(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
|||||||
@@ -1,30 +1,33 @@
|
|||||||
{% extends 'layouts/index.html' %}
|
{% extends 'layouts/index.html' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="profile-title">
|
<div class="profile-title">
|
||||||
<span class="profile-username">{{ user.name }}</span>
|
<span class="profile-username">{{ user.name }}</span>
|
||||||
{% with seen_text = user.get_last_seen() %}
|
{% with seen_text = user.get_last_seen() %}
|
||||||
{% if seen_text == 'Online now!' %}
|
{% if seen_text == 'Online now!' %}
|
||||||
<span class="profile-timestamp online">{{ seen_text }}</span>
|
<span class="profile-timestamp online">{{ seen_text }}</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="profile-timestamp offline">{{ seen_text }}</span>
|
<span class="profile-timestamp offline" title="{{ user.last_seen }}">{{ seen_text }}</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-lower">
|
<div class="profile-lower">
|
||||||
<div class="profile-left">
|
<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') }}"
|
||||||
<div class="profile-details">
|
alt="{{ user.username }}'s Profile Picture">
|
||||||
Registered {{ user.get_registration_delta() }} ago<br>
|
<div class="profile-details">
|
||||||
0 likes<br>
|
<span title="{{ user.time_registered }}">Registered {{ user.get_registration_delta() }} ago</span><br>
|
||||||
0 posts<br>
|
{# 0 likes<br>#}
|
||||||
</div>
|
{% with post_count = user.get_post_count() %}
|
||||||
</div>
|
{{ post_count }} post{% if post_count > 1 %}s{% endif %}<br>
|
||||||
<div class="profile-bio">
|
{% endwith %}
|
||||||
<p>
|
|
||||||
<strong>About me:</strong><br>
|
|
||||||
{{ user.about_me or "This user hasn't written a bio yet." }}
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="profile-bio">
|
||||||
|
<p>
|
||||||
|
<strong>About me:</strong><br>
|
||||||
|
{{ user.about_me or "This user hasn't written a bio yet." }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user