<div xmlns="http://www.w3.org/1999/xhtml"
  xmlns:py="http://genshi.edgewall.org/">
  <py:if test="not len(tickets)">No tickets found.</py:if>
  <table py:if="len(tickets)">
    <thead>
      <tr>
        <th>
          <a id="select_all" href="#" class="btn"><span>All</span></a>
          <a id="select_none" href="#" class="btn"><span>None</span></a>
        </th>
        <th data-sort="ticket_num_i">Ticket</th>
        <th data-sort="status_s">Status</th>
        <th>Description</th>
        <th data-sort="assigned_to_s">Assigned To</th>
        <th data-sort="mod_date_dt">Updated</th>
      </tr>
    </thead>
    <tbody class="ticket-list">
      <tr py:for="t in tickets">
        <td><input type="checkbox" name="${t._id}" value=""/></td>
        <td><a href="${t.url()}">[#${t.ticket_num}] ${t.summary}</a></td>
        <td class="${t.status}">${t.status}</td>
        <td py:if="len(t.description) &gt; 70">${t.description[0:70]}...</td>
        <td py:if="len(t.description) &lt;= 70">${t.description}</td>
        <td py:if="t.assigned_to_id">${t.assigned_to.display_name}</td>
        <td py:if="not t.assigned_to_id"></td>
        <td>${h.ago(t.mod_date)}</td>
      </tr>
    </tbody>
  </table>

  <h2>Update</h2>
  <form id="update-values">
    <ol>
      <li>
        <label for="assigned_to">Assigned To:</label>
        ${c.user_select.display(name='assigned_to', value='')}
      </li>
      <li>
        <label for="status">Status:</label>
        <select name="status">
          <option value="" selected="selected">no change</option>
          <option py:for="option in globals.status_names.split()" value="${option}">$option</option>
        </select>
      </li>
      <li>
        <label for="milestone">Milestone:</label>
        <select name="milestone">
          <option value="" selected="selected">no change</option>
          <option py:for="option in globals.milestone_names.split()" value="${option}">$option</option>
        </select>
      </li>
      <li py:for="field in globals.custom_fields" py:if="field.type != 'sum'">
        <label for="${field.name}">${field.label}:</label>
        <input py:if="field.type != 'select' and field.type != 'boolean'" name="${field.name}" type="text" value=""/>
        <input py:if="field.type == 'boolean'" name="${field.name}" type="checkbox" value="True"/>
        <select py:if="field.type == 'select'" name="${field.name}">
          <option value="" selected="selected">no change</option>
          <py:for each="option in field.options.split()">
            <option py:if="not option.startswith('*')" value="${option}">${option}</option>
            <option py:if="option.startswith('*')" value="${option[1:]}" selected="selected">${option[1:]}</option>
          </py:for>
        </select>
      </li>
      <li>
        <label>&nbsp;</label>
        <input type="button" onclick="update_tickets()" value="Update Tickets"/>
      </li>
    </ol>
  </form>
  <script type="text/javascript">
    var q="${Markup(query)}", count=$count, limit=$limit, page=$page, sort="${Markup(sort)}";
  </script>
</div>
