Skip to content

Commit

Permalink
Merge pull request #571 from eb1/master
Browse files Browse the repository at this point in the history
Fix #569, #570
  • Loading branch information
eb1 authored Mar 22, 2024
2 parents 488c37e + 5b01d38 commit db39bfb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion www/js/views/ProjectViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("<tr id='r-" + newID + "'><td><input type='text' class='topcoat-text-input new-row' id='s-" + newID + "' style='width:100%;' maxlength='2' value=''></td><td><input type='text' id='t-" + newID + "' class='topcoat-text-input new-row' style='width:100%;' maxlength='2' value=''></td><td><button class='topcoat-icon-button--quiet delete-row hide' title='" + i18n.t('view.ttlDelete') + "' id='d-" + newID + "'><span class='topcoat-icon topcoat-icon--item-delete'></span></button></td></tr>");
$("table").append("<tr id='r-" + newID + "'><td><input type='text' class='topcoat-text-input new-row' id='s-" + newID + "' autocapitalize='off' style='width:100%;' maxlength='2' value=''></td><td><input type='text' id='t-" + newID + "' class='topcoat-text-input new-row' autocapitalize='off' style='width:100%;' maxlength='2' value=''></td><td><button class='topcoat-icon-button--quiet delete-row hide' title='" + i18n.t('view.ttlDelete') + "' id='d-" + newID + "'><span class='topcoat-icon topcoat-icon--item-delete'></span></button></td></tr>");
},
// returns an array of objects corresponding to the current s/t values in the table
// (i.e., in the CasePairs format)
Expand Down
35 changes: 14 additions & 21 deletions www/js/views/SearchViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 = "";
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions www/tpl/NewTU.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ <h2>{{t 'view.lblNewTU'}}</h2>
<div class="chapter-list topcoat-list__container" id="Container" style="width:100%">
<div class="wizard-instructions" id="StepInstructions"></div>
<div class="control-group">
<div class="control-row"><label id="lblSource" for="txtSource"></label><input type="text" id="txtSource" class="topcoat-text-input full" value="" required></div>
<div class="control-row"><label id="lblTarget" for="txtTarget"></label><input type="text" id="txtTarget" class="topcoat-text-input full" value="" required></div>
<div class="control-row"><label id="lblSource" for="txtSource"></label><input type="text" id="txtSource" class="topcoat-text-input full" value="" autocapitalize="off" required></div>
<div class="control-row"><label id="lblTarget" for="txtTarget"></label><input type="text" id="txtTarget" class="topcoat-text-input full" value="" autocapitalize="off" required></div>
</div>
<ul class="topcoat-list__container chapter-list"><li class="topcoat-list__item li-tu"><div class="big-link filter-burnt-orange" id="btnNewRS"><div class="chap-list__item emphasized refstring-list__item"><span class="img-plus-small" style="padding-right: 16px;"></span>{{t 'view.lblNewRS'}}</div></div></li></ul>
<div class="topcoat-list__header hide" id="lblAllTrans">{{t 'view.lblAllTranslations'}} <span class="right">{{t 'view.lblFrequency'}}</span></div>
Expand Down
2 changes: 1 addition & 1 deletion www/tpl/ProjectCases.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{#each CasePairs}}
<tr id="r-{{@index}}"><td><input type="text" id="s-{{@index}}" class="topcoat-text-input s" style="width:100%;" maxlength="2" value="{{this.s}}"></td><td><input type="text" id="t-{{@index}}" class="topcoat-text-input t" style="width:100%;" maxlength="2" value="{{this.t}}"></td><td><button title="{{t 'view.ttlDelete'}}" class="topcoat-icon-button--quiet delete-row" id="d-{{@index}}"><span class="topcoat-icon topcoat-icon--item-delete"></span></button></td></tr>
{{/each}}
<tr id="r-999"><td><input type="text" id="s-999" class="topcoat-text-input new-row s" style="width:100%;" maxlength="2" value=""></td><td><input type="text" id="t-999" class="topcoat-text-input new-row t" style="width:100%;" maxlength="2" value=""></td><td><button title="{{t 'view.ttlDelete'}}" id="d-999" class="topcoat-icon-button--quiet delete-row hide"><span class="topcoat-icon topcoat-icon--item-delete"></span></button></td></tr>
<tr id="r-999"><td><input type="text" id="s-999" class="topcoat-text-input new-row s" style="width:100%;" autocapitalize="off" maxlength="2" value=""></td><td><input type="text" id="t-999" class="topcoat-text-input new-row t" style="width:100%;" maxlength="2" autocapitalize="off" value=""></td><td><button title="{{t 'view.ttlDelete'}}" id="d-999" class="topcoat-icon-button--quiet delete-row hide"><span class="topcoat-icon topcoat-icon--item-delete"></span></button></td></tr>
</table></div>
</div><div class="control-row"></div>

0 comments on commit db39bfb

Please sign in to comment.