Source

trac-ticketlinks / trac / ticket / templates / ticket_box.html

Full commit
<!--!
Ticket Box (ticket fields along with description).

Arguments:
 - ticket: the ticket to be shown
 - fields: ticket field metadata
 - description_change: metadata about changes in the description
 - can_append: True if the user is allowed to append to tickets
 - preview_mode: if True, show the "draft" background
 - reporter_link=None: rendered link for the reporter field
 - owner_link=None: rendered link for the owner field
-->
<div xmlns="http://www.w3.org/1999/xhtml"
     xmlns:py="http://genshi.edgewall.org/"
     xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:i18n="http://genshi.edgewall.org/i18n"
     id="ticket" class="${preview_mode and 'ticketdraft' or None}">
  <div class="date">
    <p i18n:msg="created" py:if="ticket.exists">Opened ${dateinfo(ticket.time)} ago</p>
    <p i18n:msg="modified" py:if="ticket.changetime != ticket.time">Last modified ${dateinfo(ticket.changetime)} ago</p>
    <p py:if="not ticket.exists"><i>(ticket not yet created)</i></p>
  </div>
  <!--! use a placeholder if it's a new ticket -->
  <h2 class="summary searchable">$ticket.summary</h2>

  <table class="properties"
         py:with="fields = [f for f in fields if not f.skip and f.name not in ('type', 'owner')]">
    <tr>
      <th id="h_reporter">Reported by:</th>
      <td headers="h_reporter" class="searchable">
        ${defined('reporter_link') and reporter_link or authorinfo(ticket.reporter)}
      </td>
      <th id="h_owner">Owned by:</th>
      <td headers="h_owner">
        ${ticket.owner and (defined('owner_link') and owner_link or authorinfo(ticket.owner)) or ''}
      </td>
    </tr>
    <tr py:for="row in group(fields, 2, lambda f: f.type != 'textarea')"
      py:with="fullrow = len(row) == 1">
      <py:for each="idx, field in enumerate(row)">
        <th py:if="idx == 0 or not fullrow"
            id="${field and 'h_' + field.name or None}">
          <py:if test="field"><i18n:msg params="field">${field.label or field.name}:</i18n:msg></py:if>
        </th>
        <td py:if="idx == 0 or not fullrow"
            headers="${field and 'h_' + field.name or None}"
            class="${field and field.name in ('cc', 'keywords') and 'searchable' or None}"
            colspan="${fullrow and 3 or None}">
          <py:if test="field">
            <py:choose test="">
              <py:when test="'rendered' in field">${field.rendered}</py:when>
              <py:otherwise>${ticket[field.name]}</py:otherwise>
            </py:choose>
          </py:if>
        </td>
      </py:for>
    </tr>
  </table>
  <div class="description">
    <h3 id="comment:description">
      Description
      <span py:if="description_change" class="lastmod" title="$description_change.date">
        <i18n:msg params="author">(last modified by ${authorinfo(description_change.author)})</i18n:msg>
        (<a href="${href.ticket(ticket.id, action='diff', version=description_change.cnum)}">diff</a>)
      </span>
    </h3>

    <!--! Quote the description (only for existing tickets) -->
    <form py:if="ticket.exists and ticket.description and can_append"
          id="addreply" method="get" action="#comment">
      <div class="inlinebuttons">
        <input type="hidden" name="replyto" value="description" />
        <input type="submit" name="reply" value="${_('Reply')}" title="Reply, quoting this description" />
      </div>
    </form>
    <div py:if="ticket.description" class="searchable" xml:space="preserve">
      ${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}
    </div>
    <br py:if="not ticket.description" style="clear: both" />
  </div>
  <div class="linked">
    <h3>Linked Issues (${len(linked_tickets)})</h3>
    <table class="listing tickets">
      <thead>
        <tr style="white-space: nowrap;">
          <th>Link</th>
          <th>Ticket</th>
          <th>Component</th>
          <th>Status</th>
          <th style="width:100%;">Summary</th>
          <th>Last modified</th>
        </tr>
      </thead>
      <tbody>
        <tr py:for="link, tkt_id, ticket in linked_tickets">
          <td class="ticket_link">${link}</td>
          <td class="ticket">${tkt_id}</td>
          <td class="component">${ticket.component}</td>
          <td class="version">${ticket.status}</td>
          <td class="summary">${shorten_line(ticket.summary)}</td>
          <td class="date">${dateinfo(ticket.changetime)}</td>
        </tr>
        <tr py:for="link, tkt_id in linked_rejects">
          <td class="ticket_link">${link}</td>
          <td class="ticket">${tkt_id}</td>
          <td class="reject" colspan="4">Ticket details unavailable</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div py:if="'TICKET_CREATE' in perm(ticket.resource)">
    <form id="newlinked" method="get" action="${context.href.newticket()}">
      <input type="hidden" id="linked-val" name="linked_val" value="${ticket.id}" />
      <label for="linked-end">New</label>
      <select id="linked-end" name="linked_end">
        <option py:for="link_label, link_end in newlinked_options"
                value="${link_end}">${link_label} ticket</option>
      </select>
      <input type="submit" name="create" value="Create" title="Create new linked ticket" />
    </form> 
  </div>
</div>