X-Git-Url: http://git.tremily.us/?a=blobdiff_plain;f=libbe%2Fcommand%2Fhtml.py;h=5186417f9da08bc375f729e298938b055ebeb6ec;hb=f41908a1f7b5a100ae1f4f143ac8f150d1d83f73;hp=eaf5f1ddc335f3de50eda5b62a27dbaefdf0c09b;hpb=0dce72cb7c6e043fd4e1d59145417de10a8937ee;p=be.git diff --git a/libbe/command/html.py b/libbe/command/html.py index eaf5f1d..5186417 100644 --- a/libbe/command/html.py +++ b/libbe/command/html.py @@ -1,7 +1,10 @@ -# Copyright (C) 2009-2012 Chris Ball +# Copyright (C) 2005-2012 Aaron Bentley +# Chris Ball # Gianluca Montecchi +# Marien Zwart # Mathieu Clabaut -# W. Trevor King +# Thomas Gerigk +# W. Trevor King # # This file is part of Bugs Everywhere. # @@ -34,6 +37,7 @@ from jinja2 import Environment, FileSystemLoader, DictLoader, ChoiceLoader import libbe import libbe.command import libbe.command.depend +import libbe.command.target import libbe.command.util import libbe.comment import libbe.util.encoding @@ -69,7 +73,6 @@ class ServerApp (libbe.util.wsgi.WSGI_AppObject, self.strip_email = strip_email self.generation_time = generation_time self._refresh = 0 - self.http_user_error = 418 self._load_templates(template_dir=template_dir) self._filters = { 'active': lambda bug: bug.active and bug.severity != 'target', @@ -146,6 +149,9 @@ class ServerApp (libbe.util.wsgi.WSGI_AppObject, index_type = 'active' else: index_type = 'inactive' + target = libbe.command.target.bug_target(self.bugdirs, bug) + if target == bug: # e.g. when bug.severity == 'target' + target = None up_link = '../../{}?type={}'.format(self._index_file, index_type) bug.load_comments(load_full=True) bug.comment_root.sort(cmp=libbe.comment.cmp_time, reverse=True) @@ -159,10 +165,12 @@ class ServerApp (libbe.util.wsgi.WSGI_AppObject, 'index_type': index_type.capitalize(), 'index_file': self._index_file, 'bug': bug, + 'target': target, 'comment_entry': self.template.get_template( 'bug_comment_entry.html'), 'comments': [(depth,comment) for depth,comment in bug.comment_root.thread(flatten=False)], + 'bug_dir': self.bug_dir, 'comment_dir': self._truncated_comment_id, 'format_body': self._format_comment_body, 'div_close': _DivCloser(), @@ -342,7 +350,7 @@ div.main { padding-top: 0; margin-top: 1em; background-color: #fcfcfc; - -moz-border-radius: 10px; + border-radius: 10px; } @@ -355,7 +363,7 @@ div.footer { margin: auto; background: #305275; color: #fffee7; - -moz-border-radius: 10px; + border-radius: 10px; } div.header { @@ -367,7 +375,7 @@ div.header { padding-bottom: 10px; background: #305275; color: #fffee7; - -moz-border-radius: 10px; + border-radius: 10px; } th.target_name { @@ -377,8 +385,8 @@ th.target_name { background-color: #305275; color: #fff; width: auto; - -moz-border-radius-topleft: 8px; - -moz-border-radius-topright: 8px; + border-top-left-radius: 8px; + border-top-right-radius: 8px; padding-left: 5px; padding-right: 5px; } @@ -456,15 +464,15 @@ td.sel.tab { background-color: #c3d9ff ; border: 1px solid #c3d9ff; font-weight:bold; - -moz-border-radius-topleft: 15px; - -moz-border-radius-topright: 15px; + border-top-left-radius: 15px; + border-top-right-radius: 15px; } td.nsel.tab { border: 1px solid #c3d9ff; font-weight:bold; - -moz-border-radius-topleft: 5px; - -moz-border-radius-topright: 5px; + border-top-left-radius: 5px; + border-top-right-radius: 5px; } table.bug_list { @@ -677,6 +685,10 @@ div.root.comment { {{ strip_email(bug.creator or '')|e }} Created : {{ (bug.time_string or '')|e }} +{% if target %} + Target : + {{ target.summary }} +{% endif %} Summary : {{ bug.summary|e }} @@ -686,6 +698,7 @@ div.root.comment { {% if comments %} {% for depth,comment in comments %} +{{ div_close(depth) }} {% if depth == 0 %}
{% else %} @@ -695,11 +708,8 @@ div.root.comment { 'depth':depth, 'bug': bug, 'comment':comment, 'comment_dir':comment_dir, 'format_body': format_body, 'div_close': div_close, 'strip_email': strip_email}) }} -{{ div_close(depth) }} {% endfor %} -{% if comments[-1][0] > 0 %} {{ div_close(0) }} -{% endif %} {% else %}

No comments.

{% endif %} @@ -795,19 +805,18 @@ class HTML (libbe.util.wsgi.ServerCommand): name='template-dir', metavar='DIR', completion_callback=libbe.command.util.complete_path)), libbe.command.Option(name='title', - help='Set the bug repository title (%default)', + help='Set the bug repository title', arg=libbe.command.Argument( name='title', metavar='STRING', default='Bugs Everywhere Issue Tracker')), libbe.command.Option(name='index-header', - help='Set the index page headers (%default)', + help='Set the index page headers', arg=libbe.command.Argument( name='index-header', metavar='STRING', default='Bugs Everywhere Bug List')), libbe.command.Option(name='min-id-length', short_name='l', help=('Attempt to truncate bug and comment IDs to this ' - 'length. Set to -1 for non-truncated IDs ' - '(%default)'), + 'length. Set to -1 for non-truncated IDs'), arg=libbe.command.Argument( name='min-id-length', metavar='INT', default=-1, type='int')), @@ -816,14 +825,14 @@ class HTML (libbe.util.wsgi.ServerCommand): libbe.command.Option(name='export-html', short_name='e', help='Export all HTML pages and exit.'), libbe.command.Option(name='output', short_name='o', - help='Set the output path for HTML export (%default)', + help='Set the output path for HTML export', arg=libbe.command.Argument( name='output', metavar='DIR', default='./html_export', completion_callback=libbe.command.util.complete_path)), libbe.command.Option(name='export-template', short_name='E', help='Export the default template and exit.'), libbe.command.Option(name='export-template-dir', short_name='d', - help='Set the directory for the template export (%default)', + help='Set the directory for the template export', arg=libbe.command.Argument( name='export-template-dir', metavar='DIR', default='./default-templates/', @@ -942,7 +951,7 @@ Html = HTML # alias for libbe.command.base.get_command_class() class _DivCloser (object): - def __init__(self, depth=0): + def __init__(self, depth=-1): self.depth = depth def __call__(self, depth):