From 2c06819bc4f221920eecfe0f42457793862f1b52 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Fri, 29 Jan 2021 11:04:39 +0200 Subject: [PATCH] Added a filter removal button to all filters # Conflicts: # Plan/common/src/main/resources/assets/plan/web/css/style.css --- .../resources/assets/plan/web/css/style.css | 6 +++++ .../resources/assets/plan/web/js/query.js | 22 ++++++++++++++----- .../main/resources/assets/plan/web/query.html | 7 +++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Plan/common/src/main/resources/assets/plan/web/css/style.css b/Plan/common/src/main/resources/assets/plan/web/css/style.css index 1ebc11682..66774a1b0 100644 --- a/Plan/common/src/main/resources/assets/plan/web/css/style.css +++ b/Plan/common/src/main/resources/assets/plan/web/css/style.css @@ -1235,6 +1235,12 @@ body.sidebar-hidden .navbar-nav { display: none; } +.filter-remover { + height: 2.4rem; + width: 2.4rem; + padding: 0; +} + .contributors li { padding: 0; } \ No newline at end of file diff --git a/Plan/common/src/main/resources/assets/plan/web/js/query.js b/Plan/common/src/main/resources/assets/plan/web/js/query.js index 558c3113b..e755cee85 100644 --- a/Plan/common/src/main/resources/assets/plan/web/js/query.js +++ b/Plan/common/src/main/resources/assets/plan/web/js/query.js @@ -11,7 +11,7 @@ let filterView = { beforeDate: null, beforeTime: null }; -const filterQuery = []; +let filterQuery = []; const InvalidEntries = { ids: [], @@ -64,7 +64,9 @@ class MultipleChoiceFilter extends Filter { const select = filterCount === 0 ? "of Players who " : "and "; let html = `
` + - `
` + + `
` + + `` + `` + @@ -155,7 +158,10 @@ class BetweenDateFilter extends Filter { `
` + `` + `
` + - `
` + `` + + `` ); } @@ -188,10 +194,16 @@ function addFilter(parentSelector, filterIndex) { const id = "f" + filterCount; const filter = createFilter(filters[filterIndex], id); filterQuery.push(filter); - $(parentSelector).append(filter.render(filterCount)); + document.querySelector(parentSelector).innerHTML += + filter.render(filterCount); filterCount++; } +function removeFilter(filterIndex) { + document.getElementById(filterIndex).remove(); + filterQuery = filterQuery.filter(f => f.id !== filterIndex); +} + function createFilter(filter, id) { switch (filter.kind) { case "activityIndexNow": diff --git a/Plan/common/src/main/resources/assets/plan/web/query.html b/Plan/common/src/main/resources/assets/plan/web/query.html index 429557362..22736cf59 100644 --- a/Plan/common/src/main/resources/assets/plan/web/query.html +++ b/Plan/common/src/main/resources/assets/plan/web/query.html @@ -237,7 +237,7 @@