Files
BellScheduler/app/templates/tasks.html

36 lines
1.6 KiB
HTML

{% extends 'base.html' %}
{% block content %}
<span><h1>{% block title %} Tasks {% endblock %}</h1></span> <a class="btn btn-primary" href="/task/new" role="button">New Task</a> <br> <br>
<div>
{% for task in tasks %}
{% set createdTime = datetime.fromtimestamp(task.created_timestamp) %}
{% set createdTime = datetime.strptime(str(createdTime), '%Y-%m-%d %H:%M:%S') %}
{% set createdTime = createdTime.astimezone(ZoneInfo(current_user.timezone)) %}
<div>
<a href="/task/{{ task.id }}">
<p><b>{{ task.title }}</b> </p>
</a>
<b>
{% if task.description != None %}
{% set description = task.description %}
{% set url_regex = '(https?://[^\s]+)' %}
{% set match = re.search(url_regex, description) %}
{% if match %}
{% set url = match.group(0) %}
{% set rest = description[match.end(0):] %}
<p>{{ description[:match.start(0)] }}<a href="{{ url }}">{{ url }}</a>{{ rest }}</p>
{% else %}
<p>{{ description }}</p>
{% endif %}
{% endif %}
</b>
<div>
<p>Created: {{ createdTime.strftime('%Y-%m-%d %I:%M %p') }}</p>
</div>
<hr>
</div>
{% endfor %}
</div>
{% endblock %}