bloodhound_theme / bhtheme / templates / bh_ticket_box.html

Full commit
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.

Ticket Box (ticket fields along with description).

 - 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
 - colcount=6: the number of fields to display in a row
<div xmlns=""
     id="ticket" class="${'ticketdraft' if preview_mode else None}">

  <py:def function="render_fields_row(fields_row, csscls, fontsize, is_inline)">
    <div class="row">
      <div py:for="idx, field in enumerate(fields_row)" py:if="field is not None"
          class="$csscls${' enum' if is_inline else None}" >
        <div class="row" py:strip="not is_inline">
          <div class="span2" py:strip="not is_inline">
            <h5 id="${'h_' + if field else None}"
                class="${'pull-right' if is_inline else None}">
              <py:if test="field"><i18n:msg params="field">${field.label or}:</i18n:msg></py:if>
          <div class="${'span2' if is_inline else None}">
            <py:if test="field">
              <py:choose test="">
                <py:when test="'rendered' in field">${field.rendered}</py:when>

  <py:with vars="fields = [f for f in fields if not f.skip and not in ('type', 'owner', 'keywords')];
      small_fields = [f for f in fields if f.type not in ('text', 'textarea') and != 'cc'];
      text_fields = [f for f in fields if f.type == 'text' or == 'cc'];
      area_fields = [f for f in fields if f.type == 'textarea'];
      _colcount = colcount or 6">
    <div class="properties" style="margin: 1.2em 0px">
      <py:with vars="_fields, csscls, count, fontsize, is_inline = 
          (small_fields, 'span4', _colcount / 2, None, True)">
        <py:for each="fields_row in group(_fields, count)">
          ${render_fields_row(fields_row, csscls, fontsize, is_inline)}
    <div class="${'well' if not preview_mode else None}">
      <!--! use a placeholder if it's a new ticket -->
      <py:for each="field in fields">
        <py:if test=" == 'keywords'">
          <div title="Keywords">
            <i class="icon-tags"></i> ${field.rendered}

      <div class="description">
        <h5 id="comment:description">
          <span py:if="description_change" class="lastmod pull-right"
            <i18n:msg params="author">(last modified by ${authorinfo(})</i18n:msg>
            (<a href="${href.ticket(, action='diff', version=description_change.cnum)}">diff</a>)
        <!--! Quote the description (only for existing tickets) -->
        <div class="pull-right">
          <form py:if="ticket.exists and ticket.description and can_append"
              id="addreply" method="get" action="#comment">
            <input type="hidden" name="replyto" value="description" />
            <input type="submit" name="reply" value="${_('Reply')}"
                class="btn btn-mini"
                title="Reply, quoting this description" />
        <div py:if="ticket.description" class="searchable" xml:space="preserve">
          ${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}
        <br py:if="not ticket.description" style="clear: both" />
    <div class="properties" style="margin-top: 1.2em">
      <py:for each="_fields, csscls, count, fontsize, is_inline in 
          [(text_fields, 'span4', colcount / 2, None, False),
           (area_fields, colspan, 1, None, False)]">
        <py:for each="fields_row in group(_fields, count)">
          ${render_fields_row(fields_row, csscls, fontsize, is_inline)}