From e7465ab2fdad6620daf5273183c04e9818ae46b7 Mon Sep 17 00:00:00 2001 From: Jachym Cepicky Date: Sat, 6 Jul 2019 22:24:08 +0200 Subject: [PATCH] more redminenish ticket filters --- helpdesk/static/helpdesk/filter.js | 21 +++ helpdesk/static/helpdesk/helpdesk-extend.css | 7 +- helpdesk/templates/helpdesk/filters/date.html | 20 +++ .../templates/helpdesk/filters/keywords.html | 13 ++ .../templates/helpdesk/filters/owner.html | 21 +++ .../templates/helpdesk/filters/queue.html | 20 +++ .../templates/helpdesk/filters/sorting.html | 39 +++++ .../templates/helpdesk/filters/status.html | 15 ++ helpdesk/templates/helpdesk/ticket_list.html | 148 ++++++++---------- 9 files changed, 219 insertions(+), 85 deletions(-) create mode 100644 helpdesk/templates/helpdesk/filters/date.html create mode 100644 helpdesk/templates/helpdesk/filters/keywords.html create mode 100644 helpdesk/templates/helpdesk/filters/owner.html create mode 100644 helpdesk/templates/helpdesk/filters/queue.html create mode 100644 helpdesk/templates/helpdesk/filters/sorting.html create mode 100644 helpdesk/templates/helpdesk/filters/status.html diff --git a/helpdesk/static/helpdesk/filter.js b/helpdesk/static/helpdesk/filter.js index 7052f5f0..7b8165ff 100644 --- a/helpdesk/static/helpdesk/filter.js +++ b/helpdesk/static/helpdesk/filter.js @@ -16,6 +16,27 @@ $(document).ready(function() { $(boxName).children("select").each(function() { this.selectedIndex = -1; }); + + var selectId = $(this).parents(".filterBox").attr('id'); + var attr = selectId.replace("filterBox", ""); + $("#filterBuilderSelect-" + attr)[0].disabled = ""; + return false; }); }); + +/** + * Called, when filterBuilderSelect input changed - will make input div appear + * to the user. Also disable this option in the Add filter menu + * + * @param {string} val name of selected filter value + */ +var onFilterChange = function(val) { + if (val) { + var boxName = "#filterBox" + val; + $(boxName).slideDown(); + $(boxName)[0].style.display="block"; + + $("#filterBuilderSelect-" + val)[0].disabled = "disabled"; + } +}; diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index 8b2e5c69..8f5fa1e3 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -24,7 +24,6 @@ Bootstrap overrides } .thumbnail.filterBox { - display: none; float: left; border: solid #ccc 1px; padding: 10px; @@ -33,10 +32,14 @@ Bootstrap overrides min-height: 200px; } -.thumbnail.filterBoxShow { +.filterBox { + display: none; +} +.filterBoxShow { display: block; } + .filterBox label { clear: both; display: block; diff --git a/helpdesk/templates/helpdesk/filters/date.html b/helpdesk/templates/helpdesk/filters/date.html new file mode 100644 index 00000000..fee486c3 --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/date.html @@ -0,0 +1,20 @@ +{% load i18n humanize %} +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+ +

{% trans "Use YYYY-MM-DD date format, eg 2018-01-30" %}

+
diff --git a/helpdesk/templates/helpdesk/filters/keywords.html b/helpdesk/templates/helpdesk/filters/keywords.html new file mode 100644 index 00000000..e46a17ab --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/keywords.html @@ -0,0 +1,13 @@ +{% load i18n humanize %} +
+
+ +
+
+ +
+
+ +
+

{% trans "Keywords are case-insensitive, and will be looked for in the title, body and submitter fields." %}

+
diff --git a/helpdesk/templates/helpdesk/filters/owner.html b/helpdesk/templates/helpdesk/filters/owner.html new file mode 100644 index 00000000..a047495d --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/owner.html @@ -0,0 +1,21 @@ +{% load i18n humanize %} +{% load static from staticfiles %} +{% load in_list %} +
+
+ +
+
+ +
+
+ +
+
{% trans "Ctrl-Click to select multiple options" %}
+
diff --git a/helpdesk/templates/helpdesk/filters/queue.html b/helpdesk/templates/helpdesk/filters/queue.html new file mode 100644 index 00000000..90caf4be --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/queue.html @@ -0,0 +1,20 @@ +{% load i18n humanize %} +{% load static from staticfiles %} +{% load in_list %} +
+
+ +
+
+ +
+
+ +
+
{% trans "Ctrl-click to select multiple options" %}
+
+ diff --git a/helpdesk/templates/helpdesk/filters/sorting.html b/helpdesk/templates/helpdesk/filters/sorting.html new file mode 100644 index 00000000..e9e08772 --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/sorting.html @@ -0,0 +1,39 @@ +{% load i18n humanize %} +{% load static from staticfiles %} +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
{% trans "Ordering applied to tickets" %}
+
diff --git a/helpdesk/templates/helpdesk/filters/status.html b/helpdesk/templates/helpdesk/filters/status.html new file mode 100644 index 00000000..edbc127a --- /dev/null +++ b/helpdesk/templates/helpdesk/filters/status.html @@ -0,0 +1,15 @@ +{% load i18n humanize %} +{% load static from staticfiles %} +{% load in_list %} +
+
+ +
+
+ +
+
+ +
+
{% trans "Ctrl-click to select multiple options" %}
+
diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 2398e6c9..0da85099 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -42,8 +42,8 @@
@@ -51,90 +51,44 @@
-
- - + + + + + + + - {% trans "Add another filter to list of filers for finer selection of displayed tickets" %} - - {% csrf_token %} + {% csrf_token %} +
-
-
- - - - -

{% trans "Ordering applied to tickets" %}

- -
+
    +
  • + {% include './filters/sorting.html' %} +
  • +
  • + {% include './filters/owner.html' %} +
  • +
  • + {% include './filters/queue.html' %} +
  • +
  • + {% include './filters/status.html' %} +
  • +
  • + {% include './filters/date.html' %} +
  • +
  • + {% include './filters/keywords.html' %} +
  • +
-
- - -

{% trans "Ctrl-Click to select multiple options" %}

- -
- -
- -

{% trans "Ctrl-click to select multiple options" %}

- -
- -
- -

{% trans "Ctrl-click to select multiple options" %}

- -
- -
- - -

{% trans "Use YYYY-MM-DD date format, eg 2018-01-30" %}

- -
- -
- -

{% trans "Keywords are case-insensitive, and will be looked for in the title, body and submitter fields." %}

- -
-
-
{% 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" %}

@@ -153,7 +107,7 @@
@@ -184,7 +138,7 @@
@@ -380,6 +334,34 @@ }); }); }) + + /** + * Disable active filtering options in filter select menu + */ + $(document).ready(function() { + {% if query_params.sorting %} + $("#filterBuilderSelect-Sort")[0].disabled = "disabled"; + {% endif %} + {% if query_params.filtering.assigned_to__id__in %} + $("#filterBuilderSelect-Owner")[0].disabled = "disabled"; + {% endif %} + {% if query_params.filtering.queue__id__in %} + $("#filterBuilderSelect-Queue")[0].disabled = "disabled"; + {% endif %} + {% if query_params.filtering.status__in %} + $("#filterBuilderSelect-Status")[0].disabled = "disabled"; + {% endif %} + {% if query_params.filtering.created__gte or query_params.filtering.created__lte %} + $("#filterBuilderSelect-Dates")[0].disabled = "disabled"; + {% endif %} + {% if query %} + $("#filterBuilderSelect-Keywords")[0].disabled = "disabled"; + {% endif %} + }); + +{% for f in query_params.filtering %} +{% endfor %} + {% endblock %}