feat: return-to-project redirects from create/edit forms

When creating or editing items from a project detail tab, users now
return to that project's tab instead of the entity's own page.
Edit links pass from_project param; forms include hidden field.
Reassigning to a different project redirects to the new project.
Decisions/meetings create from project context inserts junction rows.
File uploads from project context redirect back to project files tab.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 18:28:15 +00:00
parent ba9c36e691
commit c7a07ed280
18 changed files with 125 additions and 27 deletions

View File

@@ -67,7 +67,7 @@
{% if t.due_date %}<span class="row-meta">{{ t.due_date }}</span>{% endif %}
<span class="status-badge status-{{ t.status }}">{{ t.status|replace('_', ' ') }}</span>
<div class="row-actions">
<a href="/tasks/{{ t.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/tasks/{{ t.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/tasks/{{ t.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -87,7 +87,7 @@
<span class="row-title"><a href="/notes/{{ n.id }}">{{ n.title }}</a></span>
<span class="row-meta">{{ n.updated_at.strftime('%Y-%m-%d') if n.updated_at else '' }}</span>
<div class="row-actions">
<a href="/notes/{{ n.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/notes/{{ n.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/notes/{{ n.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -107,7 +107,7 @@
<span class="row-title"><a href="{{ l.url }}" target="_blank">{{ l.label }}</a></span>
<span class="row-meta">{{ l.url[:50] }}{% if l.url|length > 50 %}...{% endif %}</span>
<div class="row-actions">
<a href="/links/{{ l.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/links/{{ l.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/links/{{ l.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs" title="Unlink from project">Unlink</button>
</form>
@@ -146,7 +146,7 @@
<span class="row-title"><a href="/lists/{{ l.id }}">{{ l.name }}</a></span>
<span class="row-meta">{{ l.item_count }} items</span>
<div class="row-actions">
<a href="/lists/{{ l.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/lists/{{ l.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/lists/{{ l.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -166,7 +166,7 @@
<span class="row-title"><a href="/decisions/{{ d.id }}">{{ d.title }}</a></span>
<span class="status-badge status-{{ d.status }}">{{ d.status }}</span>
<div class="row-actions">
<a href="/decisions/{{ d.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/decisions/{{ d.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/decisions/{{ d.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -180,7 +180,7 @@
{% endfor %}
{% elif tab == 'meetings' %}
<a href="/meetings/create" class="btn btn-ghost btn-sm mb-3">+ New Meeting</a>
<a href="/meetings/create?project_id={{ item.id }}" class="btn btn-ghost btn-sm mb-3">+ New Meeting</a>
<div class="card mb-4">
<form action="/projects/{{ item.id }}/meetings/add" method="post" class="flex gap-2 items-end" style="padding: 12px;">
<div class="form-group" style="flex:1; margin:0;">
@@ -201,7 +201,7 @@
<span class="row-meta">{{ m.meeting_date }}</span>
<span class="status-badge status-{{ m.status }}">{{ m.status }}</span>
<div class="row-actions">
<a href="/meetings/{{ m.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/meetings/{{ m.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/meetings/{{ m.id }}/remove" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -221,7 +221,7 @@
{% if f.domain_name %}<span class="row-tag" style="{% if f.domain_color %}border-color:{{ f.domain_color }};color:{{ f.domain_color }}{% endif %}">{{ f.domain_name }}</span>{% endif %}
<span class="row-meta">{{ f.created_at.strftime('%Y-%m-%d') if f.created_at else '' }}</span>
<div class="row-actions">
<a href="/focus/{{ f.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/focus/{{ f.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/focus/{{ f.id }}/unlink" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>
@@ -262,7 +262,7 @@
{% if c.role %}<span class="row-tag">{{ c.role }}</span>{% endif %}
<span class="row-meta">{{ c.linked_at.strftime('%Y-%m-%d') if c.linked_at else '' }}</span>
<div class="row-actions">
<a href="/contacts/{{ c.id }}/edit" class="btn btn-ghost btn-xs">Edit</a>
<a href="/contacts/{{ c.id }}/edit?from_project={{ item.id }}" class="btn btn-ghost btn-xs">Edit</a>
<form action="/projects/{{ item.id }}/contacts/{{ c.id }}/remove" method="post" style="display:inline">
<button class="btn btn-ghost btn-xs">Unlink</button>
</form>