diff --git a/helpdesk/models.py b/helpdesk/models.py index 76cb8047..4e9029c5 100644 --- a/helpdesk/models.py +++ b/helpdesk/models.py @@ -372,13 +372,17 @@ class Ticket(models.Model): return u"%shelpdesk/priorities/priority%s.png" % (settings.MEDIA_URL, self.priority) get_priority_img = property(_get_priority_img) - def _get_priority_span(self): + def _get_priority_css_class(self): """ - A HTML providing a CSS_styled representation of the priority. + Return the boostrap class corresponding to the priority. """ - from django.utils.safestring import mark_safe - return mark_safe(u"%s" % (self.priority, self.priority)) - get_priority_span = property(_get_priority_span) + if self.priority == 4: + return "warning" + elif priority == 5: + return "danger" + else: + return "" + get_priority_css_class = property(_get_priority_css_class) def _get_status(self): """ diff --git a/helpdesk/templates/helpdesk/include/tickets.html b/helpdesk/templates/helpdesk/include/tickets.html index 410711ea..e83100cd 100644 --- a/helpdesk/templates/helpdesk/include/tickets.html +++ b/helpdesk/templates/helpdesk/include/tickets.html @@ -6,9 +6,9 @@ {% for ticket in ticket_list %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }} @@ -18,4 +18,4 @@ {{ ticket_list_empty_message }} {% endif %}{% endfor %} - \ No newline at end of file + diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index 3053e31b..9942eb2b 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -6,9 +6,9 @@ {% for ticket in unassigned_tickets %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.created|naturaltime }} @@ -18,4 +18,4 @@ {% trans "There are no unassigned tickets." %} {% endfor %} - \ No newline at end of file + diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 521505f2..2341037a 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -224,10 +224,10 @@ $(document).ready(function() { {% for ticket in tickets.object_list %} - + {{ ticket.ticket }} -{{ ticket.get_priority_span }} +{{ ticket.priority }} {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }}