From ce443e0bb7e7108e863a4cc4902cda08aaffea96 Mon Sep 17 00:00:00 2001 From: Erik Brommers Date: Thu, 21 Mar 2024 09:01:51 -0700 Subject: [PATCH 1/2] Fix #569 Remove autocaps for newTU page (source/target edit fields) and ProjectCases page (source/target edit fields, adding new rows) --- www/js/views/ProjectViews.js | 2 +- www/tpl/NewTU.html | 4 ++-- www/tpl/ProjectCases.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/www/js/views/ProjectViews.js b/www/js/views/ProjectViews.js index 0eaf832c..508de72b 100644 --- a/www/js/views/ProjectViews.js +++ b/www/js/views/ProjectViews.js @@ -430,7 +430,7 @@ define(function (require) { // show the delete button $(("#d-" + index)).removeClass("hide"); // add a new row (with the .new-row class) - $("table").append(""); + $("table").append(""); }, // returns an array of objects corresponding to the current s/t values in the table // (i.e., in the CasePairs format) diff --git a/www/tpl/NewTU.html b/www/tpl/NewTU.html index 55045350..e3342262 100644 --- a/www/tpl/NewTU.html +++ b/www/tpl/NewTU.html @@ -16,8 +16,8 @@

{{t 'view.lblNewTU'}}

-
-
+
+
{{t 'view.lblAllTranslations'}} {{t 'view.lblFrequency'}}
diff --git a/www/tpl/ProjectCases.html b/www/tpl/ProjectCases.html index a305f33c..b344f5ee 100644 --- a/www/tpl/ProjectCases.html +++ b/www/tpl/ProjectCases.html @@ -8,7 +8,7 @@ {{#each CasePairs}} {{/each}} - +
From 5b01d38222ce90d380226cfd3fc8ccbbb8b402d6 Mon Sep 17 00:00:00 2001 From: Erik Brommers Date: Fri, 22 Mar 2024 08:35:04 -0700 Subject: [PATCH 2/2] Fix #570 Problem due to a callback method losing the "this" variable. Added a new variable ("that") to bring the value down into the callback. --- www/js/views/SearchViews.js | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/www/js/views/SearchViews.js b/www/js/views/SearchViews.js index 65f4c800..3ea32216 100644 --- a/www/js/views/SearchViews.js +++ b/www/js/views/SearchViews.js @@ -668,18 +668,10 @@ define(function (require) { sp.save({target: target}); } }, - // Edit the spelling of a RefString instance. This does a couple things: - // - Creates a copy of the original RefString (with a N count of -(n) / not used) - // - Change the spelling of the RefString (with N = the old N), so it shows up with the same frequency + // Edit the spelling of a RefString instance. editTranslation: function (index, newRS) { var refstrings = this.model.get("refstring"); console.log("editTranslation - old target: " + refstrings[index].target + ", n: " + refstrings[index].n + ", new value: " + newRS); - // create a copy with the old value - var copyRS = { - 'target': refstrings[index].target, - 'n': -(refstrings[index].n) - }; - refstrings.push(copyRS); // set the new value refstrings[index].target = newRS; // save the changes @@ -965,21 +957,22 @@ define(function (require) { return; } // Now ask if they want to accept the change + var that = this; strConfirmText = i18next.t('view.lblOldTranslation') + " " + this.strOldSP + "\n\n" + i18next.t('view.lblNewTranslation') + " " + newSP; if (navigator.notification) { // on mobile device navigator.notification.confirm(strConfirmText, function (buttonIndex) { if (buttonIndex === 1) { // update the KB - this.editTranslation(index, newSP); + that.editTranslation(index, newSP); // reset the dirty bit - this.bDirty = false; - this.strOldSP = ""; + that.bDirty = false; + that.strOldSP = ""; } else { // User cancelled -- reset the text and dirty bit - $("#rs-" + index).html(this.strOldSP); - this.bDirty = false; - this.strOldSP = ""; + $("#rs-" + index).html(that.strOldSP); + that.bDirty = false; + that.strOldSP = ""; } }, i18next.t('view.lblEditTranslation')); } else { @@ -988,15 +981,15 @@ define(function (require) { strConfirmText = i18next.t('view.lblEditTranslation') + "\n\n" + strConfirmText; if (confirm(strConfirmText)) { // update the KB - this.editTranslation(index, newSP); + that.editTranslation(index, newSP); // reset the dirty bit - this.bDirty = false; - this.strOldSP = ""; + that.bDirty = false; + that.strOldSP = ""; } else { // User cancelled -- reset the text and dirty bit - $("#rs-" + index).html(this.strOldSP); - this.bDirty = false; - this.strOldSP = ""; + $("#rs-" + index).html(that.strOldSP); + that.bDirty = false; + that.strOldSP = ""; } } }