{{#if list.length}}
<table class="ordinary full-width task-list" width="100%">
<thead>
    <tr>
        <td></td>
        <td>{{i18n "tasks.prop.state"}}</td>
        <td>{{i18n "tasks.prop.name_id_queue"}}</td>
        <td>{{i18n "tasks.prop.author"}}</td>
        <td>{{i18n "tasks.prop.dependencies"}}</td>
        <td></td>
    </tr>
</thead>
{{#each list}}
<tbody>
    {{#*inline "task_details"}}
    <td data-id="timeline">
        {{#if this.finished_at}}
        <div data-id="finished" title="{{i18n "tasks.prop.end_time"}}" data-date="{{this.finished_at}}">{{{dash_empty (html_date this.finished_at)}}}</div>
        {{else if this.start_at}}
        <div data-id="started" title="{{i18n "tasks.prop.start_time"}}" data-date="{{this.start_at}}">{{{dash_empty (html_date this.start_at)}}}</div>
        {{else}}
        <div data-id="created" title="{{i18n "tasks.prop.creation_time"}}" data-date="{{this.created_at}}">{{{dash_empty (html_date this.created_at)}}}</div>
        {{/if}}
    </td>
    <td data-id="state">
        <span class="badge" data-value="{{this.state}}">{{this.state}}</span>
    </td>
    <td>
        <div data-id="name">{{replace this.task_name "Task$" ""}}</div>
        <div data-id="id">{{this.id}}</div>
        <div data-id="queue"{{#unless this.queue}} class="unspecified"{{/unless}}>{{fallback this.queue "<unspecified queue>"}}</div>
    </td>
    <td>{{dash_empty this.author_id}}</td>
    <td>
        {{#is this.dependencies_count 0}}
        {{this.dependencies_count}}
        {{else}}
        {{#if this.dependencies_count}}
        <a href="/organizations/{{../org.id}}/tasks/{{this.id}}/dependencies">{{this.dependencies_count}}</a>
        {{else}}
        —
        {{/if}}
        {{/is}}
    </td>
    <td data-id="meta">
        {{#if this.params}}
        <a {{#is mode "params"}}href="#/{{this.id}}" class="selected"{{else}}href="#/{{this.id}}/params"{{/is}}>params</a>
        {{/if}}
        {{#if this.result}}
        <a {{#is mode "result"}}href="#/{{this.id}}" class="selected"{{else}}href="#/{{this.id}}/result"{{/is}}>result</a>
        {{/if}}
        {{#if this.traceback}}
        <a {{#is mode "traceback"}}href="#/{{this.id}}" class="selected"{{else}}href="#/{{this.id}}/traceback"{{/is}}>traceback</a>
        {{/if}}
    </td>
    {{/inline}}
    {{#if this.params}}
    <tr data-id="params" id="/{{this.id}}/params">
    {{> task_details mode="params"}}
    </tr>
    <tr>
        <td colspan="6">
            <pre>{{{code this.params}}}</pre>
            <div class="controls">
                <a href="#/{{this.id}}" data-action="close">{{i18n "common.action.hide_nested_pane"}}</a>
            </div>
        </td>
    </tr>
    {{/if}}
    {{#if this.result}}
    <tr data-id="result" id="/{{this.id}}/result">
    {{> task_details mode="result"}}
    </tr>
    <tr>
        <td colspan="6">
            <pre>{{{code this.result}}}</pre>
            <div class="controls">
                <a href="#/{{this.id}}" data-action="close">{{i18n "common.action.hide_nested_pane"}}</a>
            </div>
        </td>
    </tr>
    {{/if}}
    {{#if this.traceback}}
    <tr data-id="traceback" id="/{{this.id}}/traceback">
    {{> task_details mode="traceback"}}
    </tr>
    <tr>
        <td colspan="6">
            <pre>{{{code this.traceback}}}</pre>
            <div class="controls">
                <a href="#/{{this.id}}" data-action="close">{{i18n "common.action.hide_nested_pane"}}</a>
            </div>
        </td>
    </tr>
    {{/if}}
    <tr id="/{{this.id}}">
    {{> task_details}}
    </tr>
</tbody>
{{/each}}
</table>
{{else}}
<div class="blank-list">{{i18n "tasks.no_tasks"}}</div>
{{/if}}
