Continue CSS cleanup for Ticket description, remove unneeded priority and button images and associated functions

This commit is contained in:
Garret Wassermann 2016-09-09 04:03:32 -04:00
parent d66259efdc
commit 67f81ac252
21 changed files with 122 additions and 185 deletions

View File

@ -461,12 +461,6 @@ class Ticket(models.Model):
return u"%s-%s" % (self.queue.slug, self.id)
ticket_for_url = property(_get_ticket_for_url)
def _get_priority_img(self):
""" Image-based representation of the priority """
from django.conf import settings
return u"%shelpdesk/priorities/priority%s.png" % (settings.MEDIA_URL, self.priority)
get_priority_img = property(_get_priority_img)
def _get_priority_css_class(self):
"""
Return the boostrap class corresponding to the priority.
@ -475,6 +469,8 @@ class Ticket(models.Model):
return "warning"
elif self.priority == 1:
return "danger"
elif self.priority == 5:
return "success"
else:
return ""
get_priority_css_class = property(_get_priority_css_class)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -1,5 +0,0 @@
* Use this template to create new buttons
* Typeface: Delicious, Roman, 12pt, Sharp Anti-Aliasing
http://www.josbuivenga.demon.nl/delicious.html
* Icons: Diagona (10px versions)
http://www.pinvoke.com/ - I purchased these before they were creative-commons, I believe this gives me rights to use them without attribution.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,4 +0,0 @@
* Typeface: Delicious, Roman, 14pt, Sharp Anti-Aliasing
http://www.josbuivenga.demon.nl/delicious.html
* Icons: Diagona (16px versions)
http://www.pinvoke.com/ - I purchased these before they were creative-commons, I believe this gives me rights to use them without attribution.

View File

@ -3,35 +3,44 @@
{% block helpdesk_title %}{% trans "Create Ticket" %}{% endblock %}
{% block helpdesk_body %}
<div class="col-xs-6">
<div class="panel panel-default">
<div class="panel-body">
<h2>{% trans "Submit a Ticket" %}</h2>
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
<form method='post' action='./' enctype='multipart/form-data'>
<fieldset>
{{ form|bootstrap }}
{% comment %}{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<dt><label for='id_{{ field.name }}'>{% trans field.label %}</label>{% if not field.field.required %} <span class='form_optional'>{% trans "(Optional)" %}</span>{% endif %}</dt>
<dd>{{ field }}</dd>
{% if field.errors %}<dd class='error'>{{ field.errors }}</dd>{% endif %}
{% if field.help_text %}<dd class='form_help_text'>{% trans field.help_text %}</dd>{% endif %}
{% endif %}
{% endfor %}
{% endcomment %}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans "Submit a Ticket" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<h2>{% trans "Submit a Ticket" %}</h2>
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
<form method='post' action='./' enctype='multipart/form-data'>
<fieldset>
{{ form|bootstrap }}
{% comment %}{% for field in form %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<dt><label for='id_{{ field.name }}'>{% trans field.label %}</label>{% if not field.field.required %} <span class='form_optional'>{% trans "(Optional)" %}</span>{% endif %}</dt>
<dd>{{ field }}</dd>
{% if field.errors %}<dd class='error'>{{ field.errors }}</dd>{% endif %}
{% if field.help_text %}<dd class='form_help_text'>{% trans field.help_text %}</dd>{% endif %}
{% endif %}
{% endfor %}
{% endcomment %}
<div class='buttons form-group'>
<input type='submit' class="btn btn-primary" value='{% trans "Submit Ticket" %}' />
</div>
</fieldset>
<div class='buttons form-group'>
<button type="submit" class="btn btn-primary btn-lg btn-block">{% trans "Submit Ticket" %}</button>
</div>
</fieldset>
{% csrf_token %}</form>
<!-- /.form -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
{% csrf_token %}</form>
</div>
</div>
</div>
{% endblock %}

View File

@ -7,8 +7,6 @@
<p>{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see tickets submitted by you, tickets you are working on, and those tickets that have no owner." %}</p>
</div>
{% include 'helpdesk/include/summary.html' %}
{% include 'helpdesk/include/stats.html' %}
{% if all_tickets_reported_by_current_user %}

View File

@ -1,42 +0,0 @@
{% load i18n %}
<div class="row">
<div class="col-lg-12">
<div class="panel panel-green">
<div class="panel-heading">
{% trans "Helpdesk Summary" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>{% trans "Queue" %}</th>
<th>{% trans "Open" %}</th>
<th>{% trans "Resolved" %}</th>
<th>{% trans "Closed" %}</th>
</tr>
</thead>
<tbody>
{% for queue in dash_tickets %}
<tr>{% url 'helpdesk_list' as hdlist %}
<td><a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{{ queue.name }}</a></td>
<td>{% if queue.open %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{% endif %}{{ queue.open }}{% if queue.open %}</a>{% endif %}</td>
<td>{% if queue.resolved %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=3'>{% endif %}{{ queue.resolved }}{% if queue.resolved %}</a>{% endif %}</td>
<td>{% if queue.closed %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=4'>{% endif %}{{ queue.closed }}{% if queue.closed %}</a>{% endif %}</td>
</tr>
{% empty %}
<tr><td colspan='6'>{% trans "There are no unassigned tickets." %}</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>

View File

@ -46,7 +46,7 @@
</tr>
{% if ticket.resolution %}<tr>
<th colspan='2'>{% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} <a href='{{ ticket.ticket_url }}&close'><img src='{% static "helpdesk/buttons/accept.png" %}' alt='{% trans "Accept" %}' title='{% trans "Accept and Close" %}' width='60' height='15' /></a>{% endifequal %}</th>
<th colspan='2'>{% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} <a href='{{ ticket.ticket_url }}&close'><button type="button" class="btn btn-primary btn-xs">{% trans "Accept and Close" %}</button></a>{% endifequal %}</th>
</tr>
<tr>
<td colspan='2'>{{ ticket.resolution|urlizetrunc:50|linebreaksbr }}</td>

View File

@ -11,7 +11,7 @@
<div class="row">
<div class="col-lg-12">
<div class="panel panel-warning">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans "Current Ticket Stats" %}
</div>

View File

@ -69,11 +69,11 @@ function processAddFileClick() {
{% 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'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs">{% 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'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs">{% trans "Delete" %}</button></a>
{% endif %}
</div>
{% else %}
@ -82,11 +82,11 @@ function processAddFileClick() {
{{ 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'><img width="60" height="15" title="Edit" alt="Edit" src="{% static "helpdesk/buttons/edit.png" %}"></a>
<a href="{% url 'helpdesk_followup_edit' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs">{% 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'><img width="60" height="15" title="Delete" alt="Delete" src="{% static "helpdesk/buttons/delete.png" %}"></a>
<a href="{% url 'helpdesk_followup_delete' ticket.id followup.id %}" class='followup-edit'><button type="button" class="btn btn-warning btn-xs">{% trans "Delete" %}</button></a>
{% endif %}
</div>
{% endif %}

View File

@ -1,71 +1,88 @@
{% load i18n humanize %}
{% load static from staticfiles %}
<table class="table table-hover table-bordered table-striped">
<thead>
<tr class='row_tablehead'><td colspan='2'><h3>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}]</h3> <span class='ticket_toolbar'>
<a href='{% url 'helpdesk_edit' ticket.id %}' class="ticket-edit"><span class="glyphicon glyphicon-pencil"></span> Edit</a>
| <a href='{% url 'helpdesk_delete' ticket.id %}' class="ticket-delete"><span class="glyphicon glyphicon-remove"></span> Delete</a>
{% if ticket.on_hold %} | <a href='{% url 'helpdesk_unhold' ticket.id %}' class="ticket-hold">{% trans "Unhold" %}</a>{% else %} | <a href='{% url 'helpdesk_hold' ticket.id %}' class="ticket-hold">{% trans "Hold" %}</a>{% endif %}
</span></td></tr>
<tr><th colspan='2'>{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}</th></tr>
</thead>
<tbody>
{% for customfield in ticket.ticketcustomfieldvalue_set.all %}
<tr>
<th>{{ customfield.field.label }}</th>
<td>{% ifequal customfield.field.data_type "url" %}<a href='{{ customfield.value }}'>{{ customfield.value }}</a>{% else %}{{ customfield.value }}{% endifequal %}</td>
</tr>{% endfor %}
<tr>
<th colspan='2'>{% trans "Description" %}</th>
</tr>
<tr>
<td id="ticket-description" colspan='2'>{{ ticket.description|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>
<div class="row">
<div class="col-lg-12">
<div class="panel panel-primary">
<div class="panel-heading">
{% trans "Ticket Summary" %}
</div>
<!-- /.panel-heading -->
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr class='row_tablehead'><td colspan='2'><h3>{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}]</h3> <span class='ticket_toolbar'>
<a href='{% url 'helpdesk_edit' ticket.id %}' class="ticket-edit"><i class="fa fa-pencil"></i> {% trans "Edit" %}</a>
| <a href='{% url 'helpdesk_delete' ticket.id %}' class="ticket-delete"><i class="fa fa-trash-o"></i> {% trans "Delete" %}</a>
{% if ticket.on_hold %} | <a href='{% url 'helpdesk_unhold' ticket.id %}' class="ticket-hold"><i class="fa fa-play"></i> {% trans "Unhold" %}</a>{% else %} | <a href='{% url 'helpdesk_hold' ticket.id %}' class="ticket-hold"><i class="fa fa-pause"></i> {% trans "Hold" %}</a>{% endif %}
</span></td></tr>
<tr><th colspan='2'>{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}</th></tr>
</thead>
<tbody>
{% for customfield in ticket.ticketcustomfieldvalue_set.all %}
<tr>
<th>{{ customfield.field.label }}</th>
<td>{% ifequal customfield.field.data_type "url" %}<a href='{{ customfield.value }}'>{{ customfield.value }}</a>{% else %}{{ customfield.value }}{% endifequal %}</td>
</tr>{% endfor %}
<tr>
<th colspan='2'>{% trans "Description" %}</th>
</tr>
<tr>
<td id="ticket-description" colspan='2'>{{ ticket.description|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>
{% if ticket.resolution %}<tr>
<th colspan='2'>{% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} <a href='?close'><img src='{% static "helpdesk/buttons/accept.png" %}' alt='{% trans "Accept" %}' title='{% trans "Accept and Close" %}' width='60' height='15' /></a>{% endifequal %}</th>
</tr>
<tr>
<td colspan='2'>{{ ticket.resolution|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>{% endif %}
<tr>
<th>{% trans "Submitted On" %}</th>
<td>{{ ticket.created|date:"r" }} ({{ ticket.created|naturaltime }})</td>
</tr>
{% if ticket.resolution %}<tr>
<th colspan='2'>{% trans "Resolution" %}{% ifequal ticket.get_status_display "Resolved" %} <a href='?close'><button type="button" class="btn btn-warning btn-xs">{% trans "Accept and Close" %}</button></a>{% endifequal %}</th>
</tr>
<tr>
<td colspan='2'>{{ ticket.resolution|force_escape|urlizetrunc:50|linebreaksbr }}</td>
</tr>{% endif %}
<tr>
<th>{% trans "Submitted On" %}</th>
<td>{{ ticket.created|date:"r" }} ({{ ticket.created|naturaltime }})</td>
</tr>
<tr>
<th>{% trans "Assigned To" %}</th>
<td>{{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} <strong><a href='?take'><span class='button button_take'>{% trans "Take" %}</span></a></strong>{% endifequal %}</td>
</tr>
<tr>
<th>{% trans "Assigned To" %}</th>
<td>{{ ticket.get_assigned_to }}{% ifequal ticket.get_assigned_to _('Unassigned') %} <strong><a href='?take'><button type="button" class="btn btn-primary btn-xs">{% trans "Take" %}</button></a></strong>{% endifequal %}</td>
</tr>
<tr>
<th>{% trans "Submitter E-Mail" %}</th>
<td>{{ ticket.submitter_email }}{% if user.is_superuser %} <strong><a href='{% url 'helpdesk_email_ignore_add' %}?email={{ ticket.submitter_email }}'>{% trans "Ignore" %}</a></strong>{% endif %}</td>
</tr>
<tr>
<th>{% trans "Submitter E-Mail" %}</th>
<td>{{ ticket.submitter_email }}{% if user.is_superuser %} <strong><a href='{% url 'helpdesk_email_ignore_add' %}?email={{ ticket.submitter_email }}'><button type="button" class="btn btn-warning btn-xs">{% trans "Ignore" %}</button></a></strong>{% endif %}</td>
</tr>
<tr>
<th>{% trans "Priority" %}</th>
<td>{{ ticket.get_priority_display }}</td>
</tr>
<tr>
<th>{% trans "Priority" %}</th>
<td>{{ ticket.get_priority_display }}</td>
</tr>
<tr>
<th>{% trans "Copies To" %}</th>
<td>{{ ticketcc_string }} <a data-toggle='tooltip' href='{% url 'helpdesk_ticket_cc' ticket.id %}' title='{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}'><strong>{% trans "Manage" %}</strong></a>{% if SHOW_SUBSCRIBE %}, <strong><a data-toggle='tooltip' href='?subscribe' title='{% trans "Click here to subscribe yourself to this ticket, if you want to receive an e-mail whenever this ticket is updated." %}'>{% trans "Subscribe" %}</a></strong>{% endif %}</td>
</tr>
<tr>
<th>{% trans "Copies To" %}</th>
<td>{{ ticketcc_string }} <a data-toggle='tooltip' href='{% url 'helpdesk_ticket_cc' ticket.id %}' title='{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}'><strong><button type="button" class="btn btn-warning btn-xs">{% trans "Manage" %}</button></strong></a>{% if SHOW_SUBSCRIBE %}, <strong><a data-toggle='tooltip' href='?subscribe' title='{% trans "Click here to subscribe yourself to this ticket, if you want to receive an e-mail whenever this ticket is updated." %}'><button type="button" class="btn btn-warning btn-xs">{% trans "Subscribe" %}</button></a></strong>{% endif %}</td>
</tr>
<tr>
<th>{% trans "Dependencies" %}</th>
<td>{% for dep in ticket.ticketdependency.all %}
{% if forloop.first %}<p>{% trans "This ticket cannot be resolved until the following ticket(s) are resolved" %}</p><ul>{% endif %}
<li><a href='{{ dep.depends_on.get_absolute_url }}'>{{ dep.depends_on.ticket }} {{ dep.depends_on.title }}</a> ({{ dep.depends_on.get_status_display }}) <a href='{% url 'helpdesk_ticket_dependency_del' ticket.id dep.id %}'>{% trans "Remove Dependency" %}</a></li>
{% if forloop.last %}</ul>{% endif %}
{% empty %}
<p>{% trans "This ticket has no dependencies." %}</p>
{% endfor %}
<p><a data-toggle='tooltip' href='{% url 'helpdesk_ticket_dependency_add' ticket.id %}' title="{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}">{% trans "Add Dependency" %}</a></p>
</td>
</tr>
<tr>
<th>{% trans "Dependencies" %}</th>
<td>{% for dep in ticket.ticketdependency.all %}
{% if forloop.first %}<p>{% trans "This ticket cannot be resolved until the following ticket(s) are resolved" %}</p><ul>{% endif %}
<li><a href='{{ dep.depends_on.get_absolute_url }}'>{{ dep.depends_on.ticket }} {{ dep.depends_on.title }}</a> ({{ dep.depends_on.get_status_display }}) <a href='{% url 'helpdesk_ticket_dependency_del' ticket.id dep.id %}'><button type="button" class="btn btn-warning btn-xs">{% trans "Remove Dependency" %}</button></a></li>
{% if forloop.last %}</ul>{% endif %}
{% empty %}
<p>{% trans "This ticket has no dependencies." %}</p>
{% endfor %}
<p><a data-toggle='tooltip' href='{% url 'helpdesk_ticket_dependency_add' ticket.id %}' title="{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}"><button type="button" class="btn btn-primary btn-xs">{% trans "Add Dependency" %}</button></a></p>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.panel-body -->
</div>
<!-- /.panel -->
</div>
</div>
</tbody>
</table>

View File

@ -122,44 +122,12 @@ def dashboard(request):
)
basic_ticket_stats = calc_basic_ticket_stats(Tickets)
# The following query builds a grid of queues & ticket statuses,
# to be displayed to the user. EG:
# Open Resolved
# Queue 1 10 4
# Queue 2 4 12
queues = _get_user_queues(request.user).values_list('id', flat=True)
from_clause = """FROM helpdesk_ticket t,
helpdesk_queue q"""
if queues:
where_clause = """WHERE q.id = t.queue_id AND
q.id IN (%s)""" % (",".join(("%d" % pk for pk in queues)))
else:
where_clause = """WHERE q.id = t.queue_id"""
cursor = connection.cursor()
cursor.execute("""
SELECT q.id as queue,
q.title AS name,
COUNT(CASE t.status WHEN '1' THEN t.id WHEN '2' THEN t.id END) AS open,
COUNT(CASE t.status WHEN '3' THEN t.id END) AS resolved,
COUNT(CASE t.status WHEN '4' THEN t.id END) AS closed
%s
%s
GROUP BY queue, name
ORDER BY q.id;
""" % (from_clause, where_clause))
dash_tickets = query_to_dict(cursor.fetchall(), cursor.description)
return render(request, 'helpdesk/dashboard.html',
{
'user_tickets': tickets,
'user_tickets_closed_resolved': tickets_closed_resolved,
'unassigned_tickets': unassigned_tickets,
'all_tickets_reported_by_current_user': all_tickets_reported_by_current_user,
'dash_tickets': dash_tickets,
'basic_ticket_stats': basic_ticket_stats,
})
dashboard = staff_member_required(dashboard)