start activity from task view

This commit is contained in:
2026-02-10 19:24:11 +01:00
parent 6344975f7e
commit b2f26b66bb
2 changed files with 36 additions and 10 deletions

View File

@@ -10,6 +10,17 @@
<span style="background: #f39c12; color: white; padding: 3px 8px; border-radius: 5px;">Template (Auto-Add)</span> <span style="background: #f39c12; color: white; padding: 3px 8px; border-radius: 5px;">Template (Auto-Add)</span>
{% endif %} {% endif %}
</p> </p>
{% if task.activity_id %}
<form action="{{ url_for('toggle_timer', activity_id=task.activity_id) }}" method="POST" style="margin-top: 10px;">
<input type="hidden" name="note" value="{{ task.name }}">
<button type="submit" class="btn" style="background: #27ae60;">
▶ Start Timer for this Task
</button>
</form>
{% else %}
<small style="color: #999;">No activity linked. Edit task to assign one.</small>
{% endif %}
</div> </div>
<a href="{{ url_for('tasks') }}" class="btn" style="background: #95a5a6;">Back to Tasks</a> <a href="{{ url_for('tasks') }}" class="btn" style="background: #95a5a6;">Back to Tasks</a>
</div> </div>

View File

@@ -39,17 +39,32 @@
<ul style="list-style: none; padding: 0;"> <ul style="list-style: none; padding: 0;">
{% for task in tasks %} {% for task in tasks %}
<li style="border-bottom: 1px solid #eee; padding: 10px 0;"> <li style="border-bottom: 1px solid #eee; padding: 10px 0;">
<div style="display: flex; justify-content: space-between;"> <div style="display: flex; justify-content: space-between; align-items: center;">
<a href="{{ url_for('task_detail', task_id=task._id) }}" style="font-weight: bold;">{{ task.name }}</a> <div>
{% if task.activity_name %} <a href="{{ url_for('task_detail', task_id=task._id) }}" style="font-weight: bold;">{{ task.name }}</a>
<span style="background: {{ task.activity_color }}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem;"> {% if task.activity_name %}
{{ task.activity_name }} <span style="background: {{ task.activity_color }}; color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; margin-left: 5px;">
</span> {{ task.activity_name }}
{% endif %} </span>
{% endif %}
</div>
<div style="display: flex; align-items: center; gap: 10px;">
{% if task.activity_id %}
<form action="{{ url_for('toggle_timer', activity_id=task.activity_id) }}" method="POST" style="margin: 0;">
<!-- Automatically use the task name as the session note -->
<input type="hidden" name="note" value="{{ task.name }}">
<button type="submit" class="btn" style="padding: 2px 8px; font-size: 0.8rem; background: #27ae60;" title="Start Timer for this Task">
▶ Start
</button>
</form>
{% endif %}
{% if task.due_date %}
<small style="color: #e74c3c;">Due: {{ task.due_date.strftime('%Y-%m-%d %H:%M') }}</small>
{% endif %}
</div>
</div> </div>
{% if task.due_date %}
<small style="color: #e74c3c;">Due: {{ task.due_date.strftime('%Y-%m-%d %H:%M') }}</small>
{% endif %}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>