mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-25 08:41:00 +00:00
parent
aa592b496a
commit
5f39e50c63
3 changed files with 22 additions and 3 deletions
|
@ -35,6 +35,19 @@ def timedeltashort(value: datetime.datetime):
|
||||||
return sign + text
|
return sign + text
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def timedeltashortenddate(value: datetime.datetime):
|
||||||
|
"""
|
||||||
|
Formatter for end dates - timedeltashort but it adds "ended ... ago" or
|
||||||
|
"left" depending on the direction.
|
||||||
|
"""
|
||||||
|
output = timedeltashort(value)
|
||||||
|
if output.startswith("-"):
|
||||||
|
return f"{output[1:]} left"
|
||||||
|
else:
|
||||||
|
return f"Ended {output} ago"
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def urlparams(context, **kwargs):
|
def urlparams(context, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1650,6 +1650,12 @@ form .post {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.poll-footer span.todo {
|
||||||
|
padding-left: 6px;
|
||||||
|
font-size: 90%;
|
||||||
|
color: var(--color-text-dull);
|
||||||
|
}
|
||||||
|
|
||||||
.post .poll ul li .votes {
|
.post .poll ul li .votes {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
font-size: small;
|
font-size: small;
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
{% if forloop.last %}</ul>{% endif %}
|
{% if forloop.last %}</ul>{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="poll-footer">
|
<div class="poll-footer">
|
||||||
<span class="vote-total">{{ post.type_data.voter_count }} people</span>
|
<span class="vote-total">{{ post.type_data.voter_count }} {{ post.type_data.voter_count|pluralize:"vote,votes" }}</span>
|
||||||
—
|
—
|
||||||
{% if post.type_data.end_time %}<span class="vote-end">{{ post.type_data.end_time|timedeltashort }}</span>{% endif %}
|
{% if post.type_data.end_time %}<span class="vote-end">{{ post.type_data.end_time|timedeltashortenddate }}</span>{% endif %}
|
||||||
<span>Polls are currently display only</span>
|
<span class="todo">Polls are currently display only</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue