$def with (torrent_list, all_torrents)
$:render.header(_('Torrent list'))

<table class="torrent_list" border=0 id='torrent_table'>
    <tr>
        $:(sort_head('calc_state_str', 'S'))
        $:(sort_head('queue_pos', '#'))
        $:(sort_head('name', _('Name')))
        $:(sort_head('total_size', _('Size')))
        $:(sort_head('progress', _('Progress')))
        $:(sort_head('num_seeds', _('Seeders')))
        $:(sort_head('num_peers', _('Peers')))
        $:(sort_head('download_rate', _('Download')))
        $:(sort_head('upload_rate', _('Upload')))
        $:(sort_head('eta', _('Eta')))
        $:(sort_head('distributed_copies', _('Ava')))
        $:(sort_head('ratio', _('Ratio')))
    </tr>
$#4-space indentation is mandatory for for-loops in templetor!
$for torrent in torrent_list:
    <tr class="torrent_table" id="torrent_$torrent.id">
    <td>
        <form action="/torrent/$torrent.action/$torrent.id" method="POST" class="pause_resume">
            <input type="image"
            src="/static/images/$(torrent.calc_state_str)16.png"
            name="pauseresume" value="submit" /></form></td>
    <td>$torrent.queue_pos</td>
    <td style="width:100px; overflow:hidden;white-space: nowrap">
        <a href="/torrent/info/$torrent.id" >
        $(crop(torrent.name, 40))</a></td>
    <td>$fsize(torrent.total_size)</td>
    <td class="progress_bar">
        <div class="progress_bar_outer">
            <div class="progress_bar" style="width:$(torrent.progress)%">
            $torrent.message $int(torrent.progress) %
            </div>
        </div>
    </td>
    <td>$torrent.num_seeds ($torrent.total_seeds)</td>
    <td>$torrent.num_peers ($torrent.total_peers)</td>
    <td>$fspeed(torrent.download_rate)</td>
    <td>$fspeed(torrent.upload_rate)</td>
    <td>$torrent.eta</td>
    <td>$("%.3f" % torrent.distributed_copies)</td>
    <td>$("%.3f" % torrent.ratio)</td\>
    </tr>
</table>



<div class="panel">
$:render.part_button('GET', '/torrent/add', _('Add torrent'), 'tango/list-add.png')
$:render.part_button('POST', '/pause_all', _('Pause all'), 'tango/pause.png')
$:render.part_button('POST', '/resume_all', _('Resume all'), 'tango/start.png')
<!--$:render.part_button('POST', '/logout', _('Logout'), 'tango/system-log-out.png')-->
</div>

$:part_stats()

$:render.footer()

