$def with (profile, form_creator)
$var title = _("Edit Disk Profile")
$var rawcss = ["plugins/disk_image/css/disk.css"]

$var hierarchy = []

$code:
    add_part = None
    rem_disk = None

<form name="profile" method="post">
    $:form_creator.disk_profile_form(profile).render()
</form>

$for disk in profile.get_disks():
    <h2>$(_("Disk %s) % $:disk.number)</h2>
    $:render.plugins.disk_image.disk_widget(disk)

    <h3>$(_("Partitions"))</h3>
    <table border="1">
        <tr>
            <th>$(_("Number"))</th>
            <th>$(_("Position"))</th>
            <th>$(_("Size"))</th>
            <th>$(_("Type"))</th>
            <th>$(_("Image"))</th>
            <th>$(_("FileSystem"))</th>
            <th>$(_("Remove"))</th>
        </tr>
        $for partition in disk.get_partitions_order_by_position():
            <tr>
                <td>$:partition.number</td>
                <td>$:partition.position</td>
                <td>$:partition.size</td>
                <td>$:partition.type</td>
                <td>$(partition.image.name if partition.image else "-")</td>
                <td>$(partition.image.filesystem if partition.image else partition.filesystem)</td>
                <td>
                    <form method="POST">
                        $:form_creator.remove_partition_form(partition).render()
                    </form>
                </td>
            </tr>
    </table>

    $ add_part = form_creator.add_partition_form(disk)
    $if add_part:
        <h3>$(_("Add Partition"))</h3>
        <form method="POST">
            $:add_part.render()
        </form>

    $ rem_disk = form_creator.remove_disk_form(disk)
    $if rem_disk:
        <h3>$(_("Remove Disk"))</h3>
        <form method="POST">
            $:rem_disk.render()
        </form>

<h2>$(_("Add Disk"))</h2>
<form method="POST">
    $:form_creator.add_disk_form().render()
</form>
