mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-13 10:21:05 +01:00
Update style of Ticket FollowUp list to be a timeline
This commit is contained in:
parent
929ec49fa8
commit
3f620e83a2
@ -74,53 +74,59 @@ $(document).on('change', ':file', function() {
|
||||
{% include "helpdesk/ticket_desc_table.html" %}
|
||||
|
||||
{% if ticket.followup_set.all %}
|
||||
<h3>{% trans "Follow-Ups" %}</h3>
|
||||
{% load ticket_to_link %}
|
||||
{% for followup in ticket.followup_set.all %}
|
||||
{% if helpdesk_settings.HELPDESK_FOLLOWUP_MOD %}
|
||||
<div class='followup_mod'>
|
||||
<div class='title'>
|
||||
<span class='byline text-info'>{{ followup.user.get_full_name }} {{ followup.date }} ({{ followup.date|naturaltime }})</span> <small>{{ followup.title }}</small>
|
||||
{% if not followup.public %} <span class='private'>({% trans "Private" %})</span>{% endif %}
|
||||
{% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
|
||||
{% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %}
|
||||
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-edit"></i> {% trans "Edit" %}</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
|
||||
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
{% endif %}
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">
|
||||
<h4><i class="fa fa-clock-o fa-fw fa-lg"></i> {% trans "Follow-Ups" %}</h4>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class='followup well'>
|
||||
<div class='title'>
|
||||
{{ followup.title }} <span class='byline text-info'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|naturaltime }}</span>{% if not followup.public %} <span class='private'>({% trans "Private" %})</span>{% endif %}</span>
|
||||
{% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
|
||||
{% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %}
|
||||
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-edit"></i> {% trans "Edit" %}</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
|
||||
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
{% endif %}
|
||||
<!-- /.panel-heading -->
|
||||
<div class="panel-body">
|
||||
<ul class="timeline">
|
||||
{% for followup in ticket.followup_set.all %}
|
||||
<li{% if not followup.user %} class="timeline-inverted"{% endif %}>
|
||||
<div class="timeline-badge{% if forloop.first %} success{% endif %}"><i class="fa {% if forloop.first %}fa-plus-square{% else %}{% if followup.ticketchange_set.all %}fa-gears{% else %}{% if followup.user %}fa-share{% else %}fa-reply{% endif %}{% endif %}{% endif %}"></i></div>
|
||||
<div class="timeline-panel">
|
||||
<div class="timeline-heading">
|
||||
<h4 class="timeline-title">{{ followup.title }}</h4>
|
||||
<p><small class="text-muted"><i class="fa fa-clock-o"></i> <span class='byline text-info'>{% if followup.user %}by {{ followup.user }}{% endif %} <span title='{{ followup.date|date:"r" }}'>{{ followup.date|naturaltime }}</span>{% if not followup.public %} <span class='private'>({% trans "Private" %})</span>{% endif %}</span></small></p>
|
||||
</div>
|
||||
<div class="timeline-body">
|
||||
<p>{% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %}</p>
|
||||
{% for change in followup.ticketchange_set.all %}
|
||||
{% if forloop.first %}<div class='changes'><ul>{% endif %}
|
||||
<li>{% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
{% for attachment in followup.attachment_set.all %}{% if forloop.first %}<hr><div class='attachments'><ul>{% endif %}
|
||||
<li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
|
||||
{% if followup.user and request.user == followup.user %}
|
||||
<a href='{% url 'helpdesk_attachment_del' ticket.id attachment.id %}'><button class="btn btn-danger btn-xs"><i class="fa fa-trash"></i> {% trans 'Delete' %}</button></a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
<hr>
|
||||
<div class="btn-group">
|
||||
{% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %}
|
||||
{% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %}
|
||||
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-edit"></i> {% trans "Edit" %}</button></a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if user.is_superuser and helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_SUPERUSER_FOLLOW_UP %}
|
||||
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs"><i class="fa fa-trash"></i> {% trans "Delete" %}</button></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
<span class='followup-desc'>{% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %}</span>
|
||||
{% for change in followup.ticketchange_set.all %}
|
||||
{% if forloop.first %}<div class='changes'><ul>{% endif %}
|
||||
<li>{% blocktrans with change.field as field and change.old_value as old_value and change.new_value as new_value %}Changed {{ field }} from {{ old_value }} to {{ new_value }}.{% endblocktrans %}</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
{% for attachment in followup.attachment_set.all %}{% if forloop.first %}<div class='attachments'><ul>{% endif %}
|
||||
<li><a href='{{ attachment.file.url }}'>{{ attachment.filename }}</a> ({{ attachment.mime_type }}, {{ attachment.size|filesizeformat }})
|
||||
{% if followup.user and request.user == followup.user %}
|
||||
<a href='{% url 'helpdesk_attachment_del' ticket.id attachment.id %}'><button class="btn btn-danger btn-xs">{% trans 'Delete' %}</button></a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% if forloop.last %}</ul></div>{% endif %}
|
||||
{% endfor %}
|
||||
<!-- /.panel-body -->
|
||||
</div>
|
||||
{% endfor %}
|
||||
<!-- /.panel -->
|
||||
|
||||
{% endif %}
|
||||
{% if helpdesk_settings.HELPDESK_TRANSLATE_TICKET_COMMENTS %}
|
||||
</div>
|
||||
@ -237,4 +243,10 @@ $(document).on('change', ':file', function() {
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$( function() {
|
||||
$( "#id_due_date" ).datepicker();
|
||||
} );
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -391,6 +391,7 @@ def update_ticket(request, ticket_id, public=False):
|
||||
|
||||
reassigned = False
|
||||
|
||||
old_owner = ticket.assigned_to
|
||||
if owner is not -1:
|
||||
if owner != 0 and ((ticket.assigned_to and owner != ticket.assigned_to.id) or not ticket.assigned_to):
|
||||
new_user = User.objects.get(id=owner)
|
||||
@ -404,10 +405,13 @@ def update_ticket(request, ticket_id, public=False):
|
||||
f.title = _('Unassigned')
|
||||
ticket.assigned_to = None
|
||||
|
||||
old_status_str = ticket.get_status_display()
|
||||
old_status = ticket.status
|
||||
if new_status != ticket.status:
|
||||
ticket.status = new_status
|
||||
ticket.save()
|
||||
f.new_status = new_status
|
||||
ticket_status_changed = True
|
||||
if f.title:
|
||||
f.title += ' and %s' % ticket.get_status_display()
|
||||
else:
|
||||
@ -455,6 +459,24 @@ def update_ticket(request, ticket_id, public=False):
|
||||
c.save()
|
||||
ticket.title = title
|
||||
|
||||
if new_status != old_status:
|
||||
c = TicketChange(
|
||||
followup=f,
|
||||
field=_('Status'),
|
||||
old_value=old_status_str,
|
||||
new_value=ticket.get_status_display(),
|
||||
)
|
||||
c.save()
|
||||
|
||||
if ticket.assigned_to != old_owner:
|
||||
c = TicketChange(
|
||||
followup=f,
|
||||
field=_('Owner'),
|
||||
old_value=old_owner,
|
||||
new_value=ticket.assigned_to,
|
||||
)
|
||||
c.save()
|
||||
|
||||
if priority != ticket.priority:
|
||||
c = TicketChange(
|
||||
followup=f,
|
||||
|
Loading…
Reference in New Issue
Block a user