From 820845b499006e695d6477fd98246f2f6c931d94 Mon Sep 17 00:00:00 2001 From: Stephan Porada Date: Mon, 29 Jun 2020 11:09:12 +0200 Subject: [PATCH] Some small fixes and user feedback --- web/app/static/js/nopaque.callbacks.js | 1 + web/app/static/js/nopaque.lists.js | 7 +++++++ web/app/templates/corpora/analyse_corpus.html.j2 | 12 +++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/web/app/static/js/nopaque.callbacks.js b/web/app/static/js/nopaque.callbacks.js index 1dd2fba9..45ee321e 100644 --- a/web/app/static/js/nopaque.callbacks.js +++ b/web/app/static/js/nopaque.callbacks.js @@ -40,6 +40,7 @@ function querySetup(payload) { let textarea = subResultsIdListElement.getElementsByTagName("textarea")[0]; textarea.innerText = ""; M.textareaAutoResize(textarea); + nrMarkedMatches.innerText = 0; results.jsList.addToSubResultsStatus = {}; results.jsList.addToSubResultsIdsToShow = new Set(); queryResultsExportElement.classList.add("disabled"); diff --git a/web/app/static/js/nopaque.lists.js b/web/app/static/js/nopaque.lists.js index a9d106f8..f2d5c0cd 100644 --- a/web/app/static/js/nopaque.lists.js +++ b/web/app/static/js/nopaque.lists.js @@ -227,12 +227,14 @@ class ResultsList extends List { this.addToSubResultsIdsToShow.add(dataIndex + 1); // + 1 because user does not see zero indexd data indexes textarea.innerText = [...this.addToSubResultsIdsToShow].sort(function(a, b){return a-b}).join(", "); // automaticalle sorts ids into the textarea in ascending order M.textareaAutoResize(textarea); // after an insert textarea has to be resized manually + nrMarkedMatches.innerText = [...this.addToSubResultsIdsToShow].length; } else if (this.addToSubResultsStatus[dataIndex]) { // add button is deactivated because status is true this.helperDeactivateBtn(event.target); this.addToSubResultsStatus[dataIndex] = false; // sets status to false this.addToSubResultsIdsToShow.delete(dataIndex + 1); // + 1 because user does not see zero indexd data indexes textarea.innerText = [...this.addToSubResultsIdsToShow].sort(function(a, b){return a-b}).join(", "); // automaticalle sorts ids into the textarea in ascending order + nrMarkedMatches.innerText = [...this.addToSubResultsIdsToShow].length; M.textareaAutoResize(textarea); // after an insert textarea has to be resized manually } // Toggles the create button accoring to the number of ids in addToSubResultsIdsToShow @@ -293,8 +295,12 @@ class ResultsList extends List { // gets result cpos infos for one dataIndex (list of length 1) to send back to // the server inspect(dataIndex, type) { + let contextMatchNrElement; // get result infos from server and show them in context modal this.contextId = dataIndex[0]; + // match nr for user to display derived from data_index + contextMatchNrElement = document.getElementById("context-match-nr"); + contextMatchNrElement.innerText = this.contextId + 1; let contextResultsElement; contextResultsElement = document.getElementById("context-results"); contextResultsElement.innerHTML = ""; // clear it from old inspects @@ -353,6 +359,7 @@ class ResultsList extends List { let uniqueS; this.contextData = response.payload; + console.log(this.contextData); this.contextData["cpos_ranges"] = response.payload.cpos_ranges; this.contextData["query"] = results.data.query; this.contextData["context_id"] = this.contextId; diff --git a/web/app/templates/corpora/analyse_corpus.html.j2 b/web/app/templates/corpora/analyse_corpus.html.j2 index 825aaf19..cbf8ae77 100644 --- a/web/app/templates/corpora/analyse_corpus.html.j2 +++ b/web/app/templates/corpora/analyse_corpus.html.j2 @@ -119,7 +119,8 @@
-

Marked matches for Sub-Results:

+

matches marked + for Sub-Results: