From 579c9db3fc033731fb9daa200988bb8764ff056e Mon Sep 17 00:00:00 2001 From: Jachym Cepicky Date: Sun, 10 Mar 2019 12:09:10 +0100 Subject: [PATCH] adding some boostrap tyles --- helpdesk/serializers.py | 4 + helpdesk/static/helpdesk/helpdesk-extend.css | 8 ++ .../templates/helpdesk/include/tickets.html | 12 ++- .../helpdesk/include/unassigned.html | 22 +++-- helpdesk/templates/helpdesk/kb_category.html | 7 +- helpdesk/templates/helpdesk/kb_index.html | 6 +- helpdesk/templates/helpdesk/ticket_list.html | 87 ++++++++++++------- .../templates/helpdesk/ticket_list_table.html | 2 +- 8 files changed, 90 insertions(+), 58 deletions(-) diff --git a/helpdesk/serializers.py b/helpdesk/serializers.py index abd95581..bacd96cc 100644 --- a/helpdesk/serializers.py +++ b/helpdesk/serializers.py @@ -19,6 +19,7 @@ class TicketSerializer(serializers.ModelSerializer): status = serializers.SerializerMethodField() row_class = serializers.SerializerMethodField() time_spent = serializers.SerializerMethodField() + queue = serializers.SerializerMethodField() class Meta: model = Ticket @@ -27,6 +28,9 @@ class TicketSerializer(serializers.ModelSerializer): 'created', 'due_date', 'assigned_to', 'row_class', 'time_spent') + def get_queue(self, obj): + return ({"title": obj.queue.title, "id": obj.queue.id}) + def get_ticket(self, obj): return (str(obj.id) + " " + obj.ticket) diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index 4fa6c7dd..8b2e5c69 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -87,3 +87,11 @@ pre { padding: 1em; border: 1pt solid white; } + +table .tickettitle { + max-width: 250px; + font-weight: bold; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} diff --git a/helpdesk/templates/helpdesk/include/tickets.html b/helpdesk/templates/helpdesk/include/tickets.html index 745b246b..bc0effd0 100644 --- a/helpdesk/templates/helpdesk/include/tickets.html +++ b/helpdesk/templates/helpdesk/include/tickets.html @@ -8,12 +8,11 @@
- - +
+ - - - + + @@ -22,9 +21,8 @@ {% for ticket in ticket_list %} - + - diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index e13bcb79..9632ab36 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -8,28 +8,26 @@
-
#{% trans "Pr" %}{% trans "Title" %}{% trans "Ticket" %}{% trans "Priority" %} {% trans "Queue" %} {% trans "Status" %} {% trans "Last Update" %}
{{ ticket.ticket }}{{ ticket.id }}. {{ ticket.title }} {{ ticket.priority }}{{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }} {{ ticket.modified|naturaltime }}
- +
+ - - - + + - - + + {% for ticket in unassigned_tickets %} - + - - {% empty %} diff --git a/helpdesk/templates/helpdesk/kb_category.html b/helpdesk/templates/helpdesk/kb_category.html index f47d0f9f..c34ea65c 100644 --- a/helpdesk/templates/helpdesk/kb_category.html +++ b/helpdesk/templates/helpdesk/kb_category.html @@ -24,12 +24,13 @@ {% cycle 'one' 'two' 'three' as itemnumperrow silent %} {% ifequal itemnumperrow 'one' %}
{% endifequal %}
-
+
{{ item.title }}
+
+

{{ item.question }}

-

- {% blocktrans with item.get_absolute_url as url %}View Answer {% endblocktrans %} + {% blocktrans with item.get_absolute_url as url %} Go to answer {% endblocktrans %}

{% trans 'Rating' %}: {{ item.score }}

diff --git a/helpdesk/templates/helpdesk/kb_index.html b/helpdesk/templates/helpdesk/kb_index.html index 7fb96f03..2516dbbc 100644 --- a/helpdesk/templates/helpdesk/kb_index.html +++ b/helpdesk/templates/helpdesk/kb_index.html @@ -18,10 +18,12 @@ {% cycle 'one' 'two' 'three' as catnumperrow silent %} {% if catnumperrow == 'one' %}
{% endif %}
+
+
{{ category.title }}
+
-
{{ category.title }}

{{ category.description }}

-

{% trans 'View articles' %}

+

{% trans 'View articles' %}

{% if catnumperrow == 'three' %}
{% endif %} diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 46db483e..2398e6c9 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -41,7 +41,7 @@
- @@ -51,7 +51,9 @@
- @@ -59,10 +61,13 @@ - + {% trans "Add another filter to list of filers for finer selection of displayed tickets" %} + {% csrf_token %} +
+
+ {% if from_saved_query and saved_query.user == user %}

{% blocktrans with saved_query.title as query_name %}You are currently viewing saved query "{{ query_name }}".{% endblocktrans %} {% trans "Delete Saved Query" %}

{% endif %} {% if from_saved_query %}

{% blocktrans with saved_query.id as query_id %}Run a report on this query to see stats and charts for the data listed below.{% endblocktrans %}

{% endif %} - {% csrf_token %} + {% csrf_token %} +
@@ -144,7 +151,7 @@
- @@ -175,7 +182,7 @@
- @@ -210,13 +217,12 @@
{{ search_message|safe }}
-
#{% trans "Pr" %}{% trans "Title" %}{% trans "Ticket" %}{% trans "Prority" %} {% trans "Queue" %}{% trans "Status" %} {% trans "Created" %}{% trans "Actions" %}
{{ ticket.ticket }}{{ ticket.id }}. {{ ticket.title }} {{ ticket.priority }}{{ ticket.title }} {{ ticket.queue }} {{ ticket.created|naturaltime }} - | - + + +
- +
+ - - - + + @@ -301,18 +307,6 @@ }, "columns": [ - {"data": "ticket", - "render": function (data, type, row, meta) - { - var id = data.split(" ")[0]; - var name = data.split(" ")[1]; - if (type === 'display') - { - data = '' + name + ''; - } - return data - } - }, {"data": "id", "orderable": false, "render": function(data, type, row, meta) @@ -324,22 +318,49 @@ return data } }, - {"data": "priority"}, - {"data": "title", + {"data": "ticket", "render": function (data, type, row, meta) { - if (type === 'display') - { - data = '' + data + ''; - } - return data + var id = data.split(" ")[0]; + var name = data.split(" ")[1]; + if (type === 'display') + { + data = ''; + } + return data } }, - {"data": "queue"}, + {"data": "priority", + "render": function (data, type, row, meta) { + var priority = "success"; + if (data == 4 ) { + priority = "warning"; + } else if (data == 5) { + priority = "danger"; + } + return '

'+data+'

'; + } + }, + {"data": "queue", + "render": function(data, type, row, meta) { + return data.title; + } + }, {"data": "status"}, {"data": "created"}, {"data": "due_date"}, - {"data": "assigned_to"}, + {"data": "assigned_to", + "render": function(data, type, row, meta) { + if (data != "None") { + return data; + } + else { + return ""; + } + } + }, {"data": "time_spent"}, ] }); diff --git a/helpdesk/templates/helpdesk/ticket_list_table.html b/helpdesk/templates/helpdesk/ticket_list_table.html index fa4b9d69..f12c39e2 100644 --- a/helpdesk/templates/helpdesk/ticket_list_table.html +++ b/helpdesk/templates/helpdesk/ticket_list_table.html @@ -5,7 +5,7 @@ - +
#  {% trans "Pr" %}{% trans "Title" %}{% trans "Ticket" %}{% trans "Prority" %} {% trans "Queue" %} {% trans "Status" %} {% trans "Created" %}
{{ ticket.ticket }} {{ ticket.priority }}{{ ticket.priority }}||||| {{ ticket.title }} {{ ticket.queue }} {{ ticket.get_status }}