From 77ab80672f5b20e849812b241054e28424ab9d09 Mon Sep 17 00:00:00 2001 From: bbe Date: Thu, 5 Nov 2020 16:39:30 +0100 Subject: [PATCH 1/7] Reformat ticket_list.html --- helpdesk/templates/helpdesk/ticket_list.html | 766 ++++++++++--------- 1 file changed, 390 insertions(+), 376 deletions(-) diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index bd5b0333..d98cfb6b 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -1,63 +1,66 @@ {% extends "helpdesk/base.html" %} -{% load i18n humanize %} -{% load static %} + +{% load i18n humanize static in_list %} {% block helpdesk_title %}{% trans "Tickets" %}{% endblock %} {% block helpdesk_head %} + {% endblock %} - {% block h1_title %}Tickets {% if from_saved_query %} [{{ saved_query.title }}]{% endif %} {% endblock %} {% block helpdesk_breadcrumb %} - -{% if from_saved_query and saved_query.user == user %} - - -{% else %} - -{% endif %} + + {% if from_saved_query and saved_query.user == user %} + + + {% else %} + + {% endif %} {% endblock %} {% block helpdesk_body %} -{% load in_list %} - -
-
- -
-
- {{ search_message|safe }} -
-
-
- - +
+
+ +
+
+ {{ search_message|safe }} +
+
+ + {% csrf_token %} +
+ - + @@ -69,357 +72,368 @@ - -
  {% trans "Ticket" %} {% trans "Priority" %} {% trans "Queue" %}{% trans "Time Spent" %} {% trans "KB item" %}
+ + -

+

+ - + - + - -

+ +

-

- - - -

- {% csrf_token %}
- -
-
-
- - - - - - - - - -
-
-
- -
- - -
-
- - {% trans "Query Selection" %} -
-
- -
-
-
-
- -
-
- -
-
-
-
- - - {% csrf_token %} - -
- -
-
    -
  • - {% include './filters/sorting.html' %} -
  • -
  • - {% include './filters/owner.html' %} -
  • -
  • - {% include './filters/queue.html' %} -
  • -
  • - {% include './filters/status.html' %} -
  • -
  • - {% include './filters/date.html' %} -
  • -
  • - {% include './filters/keywords.html' %} -
  • -
  • - {% include './filters/kbitems.html' %} -
  • -
- - - {% 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 %} +

+ + + +

+
+
-
- -
-
-
- -
-
-
-
-
- -
-
-
-
{% trans "This name appears in the drop-down list of saved queries. If you share your query, other users will see this name, so choose something clear and descriptive!" %}
- -
-
{% trans "Yes, share this query with other users." %}
-
{% trans "If you share this query, it will be visible by all other logged-in users." %}
- -
-
- -
- {% csrf_token %}
-
-
-
- -
-
-
- -
-
-
-
-
-

- - {% csrf_token %}
-
-
-
+
- +
- -
- + + +
+
+ + {% trans "Query Selection" %} +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ + +
+
+
+ +
+
    +
  • + {% include 'helpdesk/filters/sorting.html' %} +
  • +
  • + {% include 'helpdesk/filters/owner.html' %} +
  • +
  • + {% include 'helpdesk/filters/queue.html' %} +
  • +
  • + {% include 'helpdesk/filters/status.html' %} +
  • +
  • + {% include 'helpdesk/filters/date.html' %} +
  • +
  • + {% include 'helpdesk/filters/keywords.html' %} +
  • +
  • + {% include 'helpdesk/filters/kbitems.html' %} +
  • +
  • + +
  • + {% 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 %} + +
+
+
+
{% trans "This name appears in the drop-down list of saved queries. If you share your query, other users will see this name, so choose something clear and descriptive!" %}
+ +
+
{% trans "Yes, share this query with other users." %} +
+
{% trans "If you share this query, it will be visible by all other logged-in users." %}
+ +
+
+ +
+
+
+
+
+ + {% if user_saved_queries %} +
+
+
+ +
+
+
+
+
+

+ +

+ +
+
+
+
+ {% endif %} +
+ +
+ +
+ {% endblock %} {% block helpdesk_js %} - - + + + {# Shortcuts to select/unselect multiple tickets #} + $("#select_all_btn").click(function () { + $(".ticket_multi_select").prop('checked', true); + }); + $("#select_none_btn").click(function () { + $(".ticket_multi_select").prop('checked', false); + }); + $("#select_inverse_btn").click(function () { + $(".ticket_multi_select").each(function () { + $(this).prop('checked', !$(this).prop('checked')); + }); + }); + }) + {% endblock %} From f68826496b14f9af2ffe6a34e583bc77459a5d20 Mon Sep 17 00:00:00 2001 From: bbe Date: Thu, 5 Nov 2020 16:46:09 +0100 Subject: [PATCH 2/7] Fix the filterBuilderRemove and update var keyword to let or const --- helpdesk/static/helpdesk/filter.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/helpdesk/static/helpdesk/filter.js b/helpdesk/static/helpdesk/filter.js index 7b8165ff..142b27bb 100644 --- a/helpdesk/static/helpdesk/filter.js +++ b/helpdesk/static/helpdesk/filter.js @@ -1,24 +1,24 @@ $(document).ready(function() { $("#filterBuilderButton").click(function() { - var boxName = "#filterBox" + $("#filterBuilderSelect").val(); + const boxName = "#filterBox" + $("#filterBuilderSelect").val(); $(boxName).slideDown(); return false; }); $(".filterBuilderRemove").click(function() { - var boxName = "#" + $(this).parents(".filterBox").attr('id'); + const boxName = "#" + $(this).parents(".filterBox").attr('id'); $(boxName).slideUp(); - $(boxName).children("input:text").each(function() { + $(boxName).find("input:text").each(function() { $(this).val(""); }); - $(boxName).children("input:checkbox").each(function() { + $(boxName).find("input:checkbox").each(function() { this.checked = false; }); - $(boxName).children("select").each(function() { + $(boxName).find("select").each(function() { this.selectedIndex = -1; }); - var selectId = $(this).parents(".filterBox").attr('id'); - var attr = selectId.replace("filterBox", ""); + let selectId = $(this).parents(".filterBox").attr('id'); + const attr = selectId.replace("filterBox", ""); $("#filterBuilderSelect-" + attr)[0].disabled = ""; return false; @@ -31,9 +31,9 @@ $(document).ready(function() { * * @param {string} val name of selected filter value */ -var onFilterChange = function(val) { +const onFilterChange = function(val) { if (val) { - var boxName = "#filterBox" + val; + const boxName = "#filterBox" + val; $(boxName).slideDown(); $(boxName)[0].style.display="block"; From ba5847b5bdae8628cb99134514901ff3b7049170 Mon Sep 17 00:00:00 2001 From: bbe Date: Thu, 5 Nov 2020 16:47:32 +0100 Subject: [PATCH 3/7] Disable Date Range option in Filter Box if the to_date already provided --- helpdesk/templates/helpdesk/ticket_list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index d98cfb6b..4fbb47c9 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -173,7 +173,7 @@ -