{% extends g.theme.master %}
{% do g.register_forge_css('css/forge/hilite.css') %}
{% do g.register_app_css('css/tracker.css') %}
{% block title %}{{c.project.name}} / {{c.app.config.options.mount_label}} / #{{ticket.ticket_num}} {{ticket.summary}}{% endblock %}
{% block head %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="feed.rss"/>
<link rel="alternate" type="application/atom+xml" title="Atom" href="feed.atom"/>
{% endblock %}
{% block header %}#{{ticket.ticket_num}} {{ticket.summary}}{% endblock %}
{% block actions %}
<a href="{{ticket.url()}}feed.rss" title="Follow this Ticket"><b data-icon="f" class="ico"></b></a>
{% if c.user and c.user != c.user.anonymous() %}
{{c.subscribe_form.display(value=subscribed, tool_subscribed=tool_subscribed, action='subscribe', style='icon')}}
<a href="#" title="Edit" class="edit_ticket"><b data-icon="p" class="ico"></b></a>
{% endif %}
{% endblock %}
{% block edit_box %}
<div class="editbox">
<div class="form_holder" style="display: none">
{{c.ticket_form.display(action='%supdate_ticket_from_widget' % ticket.url(),
value=ticket, ticket=ticket, show_comment=True)}}
</div>
<div class="view_holder">
{% if '_milestone' in ticket.custom_fields %}
<div class="grid-4">
<label class="simple">Milestone: </label>
{% if ticket.custom_fields['_milestone'] %}
<a href="{{c.app.url}}milestone/{{ticket.custom_fields['_milestone']}}">{{ticket.custom_fields['_milestone']}}</a>
{% else %}
None
{% endif %}
</div>
{% endif %}
<div class="grid-4">
<label class="simple">Status: </label>
<span class="{{ticket.open_or_closed}}">{{ticket.status}}</span>
</div>
<div class="grid-4 ticket-assigned-to">
<label class="simple">Owner: </label>
{% if ticket.assigned_to_id %}
<a href="{{ticket.assigned_to.url()}}">{{ticket.assigned_to_name()}}</a>
{% else %}
{{ticket.assigned_to_name()}}
{% endif %}
</div>
<div class="grid-4">
<label class="simple">Labels: </label>
{% for label in ticket.labels %}
<span class="ui-corner-all tag">
<a href="../search?q=labels:{{h.urllib.quote_plus(label)}}">{{label}} ({{ticket.artifacts_labeled_with(label).count()}})</a>
</span>
{% else %}
None
{% endfor %}
</div>
<div style="clear:both"></div>
{% set min_c_fields = '_milestone' in ticket.custom_fields and 1 or 0 %}
{% if globals.custom_fields and globals.custom_fields.__len__() > min_c_fields %}
{% set cf_count=0 %}
{% for field in globals.custom_fields or [] %}
{% if field.name != '_milestone' %}
{% if cf_count%4 == 0 and cf_count != 0 %}
<div style="clear:both"></div>
{% endif %}
<div class="grid-4">
<label class="simple">{{field.label}}:</label>
{{ticket.custom_fields[field.name]}}
</div>
{% set cf_count=cf_count+1 %}
{% endif %}
{% endfor %}
{% endif %}
<div style="clear:both"></div>
<div class="grid-4">
<label class="simple">Updated:</label>
{{h.ago(ticket.mod_date)}}
</div>
<div class="grid-4">
<label class="simple">Created:</label>
{{h.ago(ticket.created_date)}}
</div>
<div class="grid-8">
<label class="simple">Creator:</label>
<a href="{{ticket.reported_by.url()}}">{{ticket.reported_by.display_name}}</a>
</div>
</div>
</div>
{% endblock %}
{% block content %}
<div id="ticket_content">
{{g.markdown.convert(ticket.description)|safe}}
{% if ticket.attachments %}
<strong>{{ticket.attachments.__len__()}} Attachments</strong>
<div class="clear">
{% for att in ticket.attachments %}
<div class="attachment_thumb">
{% if att.is_image() and not att.is_embedded() %}
<a href="{{att.url()}}" class="file_type">
<img src="{{att.url()}}/thumb">
</a>
{% else %}
<a href="{{att.url()}}" class="file_type">
<span>{{att.filename.split('.')[-1] or 'file'}}</span>
</a>
{% endif %}
<a href="{{att.url()}}">{{att.filename}}</a>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endblock %}
{% block after_content %}
<div id="discussion_holder">
<h2>Discussion</h2>
{% set thread=ticket.discussion_thread %}
{{c.thread.display(value=thread,new_post_text="New Comment",page=page,limit=limit,count=count)}}
</div>
{% endblock %}
{% block extra_js %}
{% if h.has_artifact_access('write', ticket)() %}
<script type="text/javascript">
$(document).ready(function() {
// show/hide form
var form_holder = $('div.form_holder');
var view_holder = $('div.view_holder');
var discussion_holder = $('#discussion_holder')
var ticket_content = $('#ticket_content');
var title_holder = $('h1.title');
var original_title = title_holder.text();
$('a.edit_ticket, div.view_holder, #ticket_content').click(function(){
form_holder.show();
view_holder.hide();
discussion_holder.hide();
ticket_content.hide();
title_holder.text('\u00A0');
$('a.edit_ticket').addClass('btn_activate');
$('textarea[name="ticket_form.description"]').focus()
return false;
});
$('a.cancel_form').click(function(){
form_holder.hide();
view_holder.show();
discussion_holder.show();
ticket_content.show();
title_holder.text(original_title);
$('a.edit_ticket').removeClass('btn_activate');
return false;
});
// delete attachments
$('div.attachment_thumb a.delete_attachment').click(function(){
$.post(this.href, {'delete': 'True'}, function(){
location.reload();
});
return false;
});
// Allow the ticket metadata links to function without turning on edit mode
$('.editbox a, #ticket_content a').click(function(event){
event.stopPropagation();
});
});
</script>
{% endif %}
{% endblock %}
{% block extra_css %}
<style type="text/css">
input[name='ticket_form.summary']{
top: 5px;
position: absolute;
z-index: 21;
}
div.form_holder .reply textarea{
height: 60px;
}
div.actions{
width: 150px;
}
.markdown_edit textarea {
height: 100px;
}
</style>
{% endblock %}