{#- The session card, shared by the board's task dialog and the task page (design 0025). An open card shows, top to bottom: the state line; what waits for the owner (open approvals and questions, unread agent replies); the next step and what holds the card; its approvals (a pending one with its buttons unfolded); the plan; the last report; deploy notes; description and progress; then folded secondary blocks. A done or archived card leads with its last report and code, the rest folded. A block with nothing in it is left out. Expects: detail, optional error. Refetched on live events, so it holds no form state of its own: the comment box lives outside it (_comment_form.html). -#} {%- set t = detail.task -%} {%- set is_done = t.stage.value == "done" %} {%- set is_live = t.stage.value == "live" %} {%- set closed = is_done or t.archived_at %} {#- Folds whose default differs between an open and a closed card keep the owner's choice apart. #} {%- set fp = "done-" if closed else "" %} {%- set d = detail.document %} {%- set questions = detail.questions %} {%- set approvals = detail.approvals %} {%- set replies = detail.unread_replies %}

{{ t.title }}

{% if error %}{% endif %} {% include "_state_line.html" %} {#- The day time log (design 0028): always shown, one line under the session's state. #} {%- set tm = detail.time %} {%- set time_url = "/p/" ~ t.project_slug ~ "/t/" ~ t.key ~ "/timelog" %}
Time today {{ tm.today|hm }} · total {{ tm.total|hm }} · in tracker {{ tm.tracker|hm_minutes }}{% if tm.current %} now since {{ tm.since.strftime("%H:%M") }}{% endif %} {%- for kind, text in [("now", "Working on this now")] + ([("pause", "Pause")] if tm.current else []) %}
{%- endfor %}
{%- set approvals_block %} {% if approvals.open or approvals.closed %}

Approvals {% if approvals.open %}{{ approvals.open|length }} waits{% else %}{{ approvals.closed|length }} decided{% endif %}

{% with error = none %}{% include "_approvals.html" %}{% endwith %}
{% endif %} {%- endset %} {%- set questions_block %}

Questions

{% with error = none %}{% include "_questions.html" %}{% endwith %}
{%- endset %} {#- a. What waits for the owner, on every card; approvals sit right under Next (below). #} {% if questions.open %}{{ questions_block }}{% endif %} {% if replies %}

Unread replies {{ replies|length }}

    {% for c in replies %}
  1. {{ "Agent" if c.author.startswith("local_") else c.author }}
    {{ c.body_md|markdown(detail.doc_refs) }}
  2. {% endfor %}

Mark them read under Comments; a comment you send marks them read too.

{% endif %} {%- set now_block %} {% if t.cancelled or t.waiting_on or t.next_step or detail.blocked_by or detail.blocks %}

Next

{% if t.cancelled %}
Cancelled
cancelled {{ t.cancelled }}{% if t.cancelled_at %} {% endif %}
{% endif %} {%- set stale = t.next_step_stale and not is_done %} {% if t.next_step %}
Next step
{{ t.next_step }}{% if stale %} stale{% endif %}{% endif %} {% if t.waiting_on %}
Waiting on
{% if is_done %}{{ t.waiting_on }}{% else %}{{ t.waiting_on }}{% endif %}
{% endif %} {% if detail.blocked_by %}
Blocked by
    {%- for b in detail.blocked_by %}{{ b.key }} {{ label(b.stage) }} {{ b.title }}{% if not b.active %} (no longer blocks){% endif %}{% endfor %}
{% endif %} {% if detail.blocks %}
Blocks
    {%- for b in detail.blocks %}{{ b.key }} {{ label(b.stage) }} {{ b.title }}{% endfor %}
{% endif %}
{% endif %} {%- endset %} {%- set plan_block %} {%- set plan = detail.plan %} {% if plan.steps %} {%- set current = plan.current %}

Plan {{ plan.done }}/{{ plan.steps|length }}

{{ "Accepted" if plan.status == "accepted" else "Draft" }}{% if plan.deviations %} · {{ plan.deviations }} deviation{{ "s" if plan.deviations > 1 else "" }}{% endif %}

    {% for s in plan.steps %}
  1. {{ s.title }} {{ s.status|replace("_", " ") }}
  2. {% endfor %}
{% endif %} {%- endset %} {%- set report_block %} {% if detail.reports %}

Last report

{% for r in detail.reports %} {% if loop.first %}
{% with state = r.state, size = r.size %}{% include "_report_badges.html" %}{% endwith %} {{ r.author }} ·
{{ r.body_md|markdown(detail.doc_refs) }}
{% with checks = detail.checks.get(r.id, []), warning = detail.marks_warning(r) %}{% include "_report_checks.html" %}{% endwith %}
{% else %} {% if loop.index == 2 %}

Earlier reports

{% endif %} {#- app.js reopens these by report id after a live refresh of this fragment. #}
{% with state = r.state, size = r.size %}{% include "_report_badges.html" %}{% endwith %} {{ r.summary }} {{ r.author }} ·
{{ r.body_md|markdown(detail.doc_refs) }}
{% with checks = detail.checks.get(r.id, []), warning = detail.marks_warning(r) %}{% include "_report_checks.html" %}{% endwith %}
{% endif %} {% endfor %}
{% endif %} {%- endset %} {%- set deploy_block %} {% if t.deploy_notes %}

Deploy notes

{% if t.deploy_done %}done{% else %}not done yet{% endif %}

{{ t.deploy_notes|markdown(detail.doc_refs) }}
{% endif %} {%- endset %} {%- set text_block %} {% if t.description %}

Description

{{ t.description|markdown(detail.doc_refs) }}
{% endif %} {% if t.progress %}

Done so far

{{ t.progress|markdown(detail.doc_refs) }}
{% endif %} {%- endset %} {% if closed %} {#- A closed card: its summary first, the rest folded. #} {{ report_block }} {% if detail.code.board_shown %}

Code

{% with c = detail.code, branch = t.branch %}{% include "_code_row.html" %}{% endwith %}
{% endif %} {{ now_block }} {{ approvals_block }} {{ plan_block }} {{ deploy_block }} {{ text_block }} {% else %} {{ now_block }} {{ approvals_block }} {{ plan_block }} {{ report_block }} {{ deploy_block }} {{ text_block }} {% endif %} {#- g. Secondary blocks, folded. #}

Task details

{% if t.area %}
Area
{% include "_area_chip.html" %}
{% endif %}
Stage
{{ label(t.stage.value) }}{% if t.stage_note %} {{ t.stage_note }}{% endif %}
{% if t.branch %}
Branch
{{ t.branch }}
{% endif %} {% if detail.code.board_shown and not closed %}
Code
{% with c = detail.code, branch = t.branch %}{% include "_code_row.html" %}{% endwith %}
{% endif %} {% if t.tracker_ref or t.tracker_name or t.tracker_url or t.tracker_logged or (tracker_log_required(t) and is_done) %}
Tracker
{% include "_tracker.html" %} {%- if t.tracker_url and not t.tracker_ref %}{% set href = t.tracker_url|http_url %}{% if href %} {{ t.tracker_name or href }}{% endif %}{% endif %} {%- if t.tracker_ref and not t.tracker_logged and not is_done %} work log not entered yet{% endif %}
{% endif %} {% if d and d.ref.href %}
Document
{{ d.doc.title }}{% if d.link.anchor %} · #{{ d.link.anchor }}{% endif %}{% if d.ref.broken %} {{ d.ref.broken }}{% endif %}
{% elif t.doc_path %}
Document
{{ t.doc_path }}{% if d and d.ref.broken %} {{ d.ref.broken }}{% endif %}
{% endif %} {% if detail.sections %}
Sections
    {%- for sec in detail.sections %}
  • {% if sec.ref.href %}{{ sec.link.doc }}#{{ sec.link.anchor }}{% else %}{{ sec.link.doc }}#{{ sec.link.anchor }}{% endif %}{% if sec.title %} {{ sec.title }}{% endif %}{% if sec.ref.broken %} {{ sec.ref.broken }}{% endif %}
  • {% endfor %}
{% endif %} {% if is_done or is_live %}{% set in_archive = task_archived(t) %}
Archive
{% if t.archived_at %}archived by {{ t.archived_by }}{% if t.archived_from %} · closed from live, comes back to live{% endif %}{% elif in_archive %}archived: closed more than {{ done_window_days }} days ago{% elif is_live %}in the live column; Archive closes it{% else %}in the done column{% endif %}
{% endif %} {% if detail.from_backlog %}
Backlog
From backlog #{{ detail.from_backlog.id }}
{% endif %}
Updated
· v{{ t.version }}
{#- Without a session or a history the fold still hosts the picker that binds one. #} {% if t.session_name or detail.bindings or detail.bind_choices %}

Session and its history

{% if t.session_name %}
{% with name = t.session_name, status = t.session_status, link = t.session_link %}{% include "_session.html" %}{% endwith %}
{% if t.session_external_id %}

{{ t.session_external_id }}

{% endif %} {% if t.session_activity_at %}

{% if t.session_status %}{{ t.session_status }} {% endif %}last activity: {{ t.session_activity or "—" }} ·

{% endif %}
{% else %}

No session is bound to this task.

{% endif %} {% if detail.bind_choices %}
{{ "Bind another session" if t.session_name else "Bind a session" }}
{% for s in detail.bind_choices %} {%- if s.external_id %} {%- set label = s.name if s.name != s.external_id else "Untitled desktop session" %} {%- set ref = s.external_id %} {%- else %} {%- set label = s.name.split(" · ")[0] if s.cc_session_id and " · " in s.name else s.name %} {%- set ref = s.cc_session_id or "" %} {%- endif %} {% endfor %}
{% endif %} {% if detail.bindings %}

History

    {% for b in detail.bindings %}
  1. {{ b.session_name }} {% if b.session_external_id and b.session_external_id != b.session_name %}{{ b.session_external_id }}{% endif %} bound by {{ b.bound_by }} {% if b.unbound_at %}· until {% else %}· current{% endif %}
  2. {% endfor %}
{% endif %}
{% endif %} {% if not questions.open and questions.closed %}{{ questions_block }}{% endif %} {% if detail.decisions %}

Decisions

{% endif %} {% if detail.findings %}

Findings

{% endif %} {% if d and d.doc %}

Document: {{ d.doc.title }}{% if d.link.anchor and not d.ref.broken %} · #{{ d.link.anchor }}{% endif %}

{{ d.doc.slug }} · {{ d.doc.kind }} · version {{ d.doc.version }} · history{% if d.doc.source_url and d.doc.source_url|http_url %} · lives in the repository: {{ d.doc.source_url }}{% endif %}

{% if d.ref.broken %}

No section #{{ d.link.anchor }}; the whole document follows.

{% endif %} {% if d.text %}
{{ d.text|document }}
{% else %}

No text here.

{% endif %}
{% endif %} {% if detail.tracker_history %}

Tracker history

    {% for e in detail.tracker_history %} {%- set href = e.tracker_url|http_url %} {%- set text = (e.tracker_name ~ " " if e.tracker_name else "") ~ e.tracker_ref %}
  1. {% if href %}{{ text }}{% else %}{{ text }}{% endif %} — {%- if e.logged_at %} logged {% endif %} {%- if e.logged_at and e.unlogged_at %} ·{% endif %} {%- if e.unlogged_at %} unlogged {% endif %} {%- if not e.logged_at and not e.unlogged_at %} not logged{% endif %}
  2. {% endfor %}
{% endif %} {% if detail.live_actions %}

Actions on live

    {% for e in detail.live_actions %}{% include "_live_action.html" %}{% endfor %}
{% endif %}