Skip to content

Commit

Permalink
Work on adapt-it#598
Browse files Browse the repository at this point in the history
Add URLs for each of the settings, so that the Back functionality is consistent.
  • Loading branch information
eb1 committed Sep 17, 2024
1 parent be58f14 commit 33dd0e7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 83 deletions.
9 changes: 9 additions & 0 deletions www/js/Application.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,15 @@ define(function (require) {
window.Application.main.show(new ProjectViews.EditProjectView({model: proj[0]}));
}
},
editProjectPage: function (id, page) {
// edit the selected project
var proj = this.ProjectList.where({projectid: id});
var projView = new ProjectViews.EditProjectView({model: proj[0]});
if (proj !== null) {
window.Application.main.show(projView);
projView.ShowView(parseInt(page, 10));
}
},
// Copy project view
copyProject: function () {
var proj = new projModel.Project();
Expand Down
1 change: 1 addition & 0 deletions www/js/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ define(function (require) {
"copy": "copyProject", // #copy
"project": "newProject", // #project
"project/:id": "editProject", // #project/projectID
"project/:id/:page": "editProjectPage", // #project/projectID/page number (detail view for edit project)
"search/:id": "lookupChapter", // #search/projectID
"kb/:id": "editKB", // #kb/projectID (KB editor)
"tu": "newTU", // #tu (create a new TU)
Expand Down
91 changes: 20 additions & 71 deletions www/js/views/ProjectViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -1123,17 +1123,7 @@ define(function (require) {
'change': 'render'
},
events: {
"click #EditorUIPrefs": "OnEditorUIPrefs",
"click #CurrentProject": "OnCurrentProject",
"click #KBEditor": "OnKBEditor",
"click #SourceLanguage": "OnEditSourceLanguage",
"click #TargetLanguage": "OnEditTargetLanguage",
"click #sourceFont": "OnEditSourceFont",
"click #targetFont": "OnEditTargetFont",
"click #navFont": "OnEditNavFont",
"click #Punctuation": "OnEditPunctuation",
"click #Cases": "OnEditCases",
"click #Filtering": "OnEditFiltering",
"focus #LanguageName": "onFocusLanguageName",
"keydown #LanguageName": "onKeydownLanguageName",
"focus #LanguageVariant": "onFocusLanguageVariant",
Expand All @@ -1151,17 +1141,10 @@ define(function (require) {
"click #Cancel": "OnCancel",
"click #OK": "OnOK"
},
OnEditorUIPrefs: function () {
step = 9;
this.ShowView(step);
},
OnCurrentProject: function () {
step = 10;
this.ShowView(step);
},
OnKBEditor: function () {
// KB editor is on a separate screen; tell the application to display it
window.Application.editKB(window.Application.currentProject.get("projectid"));
// URL is: kb/:projectid
window.Application.router.navigate("kb/" + window.Application.currentProject.get("projectid"), {trigger: true});
},
onFocusLanguageName: function (event) {
window.Application.scrollIntoViewCenter(event.currentTarget);
Expand Down Expand Up @@ -1252,63 +1235,27 @@ define(function (require) {
OnClickCustomFilters: function (event) {
currentView.onClickCustomFilters(event);
},
OnEditSourceLanguage: function () {
step = 1;
this.ShowView(step);
},
OnEditTargetLanguage: function () {
step = 2;
this.ShowView(step);
},
OnEditSourceFont: function () {
step = 3;
this.ShowView(step);
},
OnEditTargetFont: function () {
step = 4;
this.ShowView(step);
},
OnEditNavFont: function () {
step = 5;
this.ShowView(step);
},
OnEditPunctuation: function () {
step = 6;
this.ShowView(step);
},
OnEditCases: function () {
step = 7;
this.ShowView(step);
},
OnEditFiltering: function () {
step = 8;
this.ShowView(step);
},
OnCancel: function () {
// just display the project settings list (don't save)
$("#WizStepTitle").hide();
$("#StepInstructions").addClass("hide");
$("#tbBottom").addClass("hide");
$('#ProjectItems').removeClass("hide");
$("#StepTitle").html(i18n.t('view.lblProjectSettings'));
$(".container").attr("style", "height: calc(100% - 70px);");
$("#editor").removeClass("scroller-bottom-tb");
$("#editor").addClass("scroller-notb");
this.removeRegion("container");
// just go back (don't save)
if (window.history.length > 1) {
// there actually is a history -- go back
window.history.back();
} else {
// no history (import link from outside app) -- just go home
window.location.replace("");
}
},
OnOK: function () {
// save the info from the current step
this.UpdateProject(step);
// show / hide the appropriate UI elements
$("#WizStepTitle").hide();
$("#StepInstructions").addClass("hide");
$("#tbBottom").addClass("hide");
$('#ProjectItems').removeClass("hide");
$("#StepTitle").html(i18n.t('view.lblProjectSettings'));
$(".container").attr("style", "height: calc(100% - 70px);");
$("#editor").removeClass("scroller-bottom-tb");
$("#editor").addClass("scroller-notb");
this.removeRegion("container");
// go back
if (window.history.length > 1) {
// there actually is a history -- go back
window.history.back();
} else {
// no history (import link from outside app) -- just go home
window.location.replace("");
}
},

UpdateProject: function (step) {
Expand Down Expand Up @@ -1465,6 +1412,8 @@ define(function (require) {
this.addRegions({
container: "#StepContainer"
});
// set the current step #
step = number;
// hide the project list items
$("#WizStepTitle").show();
$("#StepInstructions").removeClass("hide");
Expand Down
22 changes: 11 additions & 11 deletions www/tpl/EditProject.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}}
<div class="topcoat-navigation-bar main_title bg-lightblue">
<div class="topcoat-navigation-bar__item">
<a class="topcoat-icon-button--quiet back-button" href="#">
<a id="back" class="topcoat-icon-button--quiet back-button">
<span class="topcoat-icon topcoat-icon--back"></span>
</a>
</div>
Expand All @@ -24,12 +24,12 @@ <h1 class="topcoat-navigation-bar__title bg-lightblue" id="StepTitle">{{t 'view.
<div class="topcoat-list__header" id="lblAllTrans">{{t 'view.lblGeneralSettings'}}</div>
<ul class="chapter-list topcoat-list__container">
<li class="topcoat-list__item">
<a id="EditorUIPrefs">
<a id="EditorUIPrefs" href="#project/{{this.projectid}}/9">
<header><h3>{{t 'view.ttlEditorUI'}}</h3></header>
<span class="chevron"></span></a>
</li>
<li class="topcoat-list__item">
<a id="CurrentProject">
<a id="CurrentProject" href="#project/{{this.projectid}}/10">
<header><h3>{{t 'view.ttlManageProjects'}}</h3></header>
<span class="chevron"></span></a>
</li>
Expand All @@ -42,49 +42,49 @@ <h1 class="topcoat-navigation-bar__title bg-lightblue" id="StepTitle">{{t 'view.
<div class="topcoat-list__header" id="lblAllTrans">{{t 'view.ttlCurrentProjectSettings'}}</div>
<ul class="chapter-list topcoat-list__container">
<li class="topcoat-list__item">
<a id="SourceLanguage">
<a id="SourceLanguage" href="#project/{{this.projectid}}/1">
<header><h3>{{t 'view.lblSourceLanguageName'}}: {{SourceLanguageName}}</h3></header>
<div class="control-row">{{t 'view.lblCode'}}: {{SourceLanguageCode}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="TargetLanguage">
<a id="TargetLanguage" href="#project/{{this.projectid}}/2">
<header><h3>{{t 'view.lblTargetLanguageName'}}: {{TargetLanguageName}}</h3></header>
<div class="control-row">{{t 'view.lblCode'}}: {{TargetLanguageCode}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="sourceFont">
<a id="sourceFont" href="#project/{{this.projectid}}/3">
<header><h3>{{t 'view.lblSourceFont'}}</h3></header>
<div style="color: {{SourceColor}}; font-size: {{SourceFontSize}}px; font-family: '{{SourceFont}}';">{{SourceFont}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="targetFont">
<a id="targetFont" href="#project/{{this.projectid}}/4">
<header><h3>{{t 'view.lblTargetFont'}}</h3></header>
<div style="color: {{TargetColor}}; font-size: {{TargetFontSize}}px; font-family: '{{TargetFont}}';">{{TargetFont}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="navFont">
<a id="navFont" href="#project/{{this.projectid}}/5">
<header><h3>{{t 'view.lblNavFont'}}</h3></header>
<div style="color: {{NavigationColor}}; font-size: {{NavigationFontSize}}px; font-family:'{{NavigationFont}}';">{{NavigationFont}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="Punctuation">
<a id="Punctuation" href="#project/{{this.projectid}}/6">
<header><h3>{{t 'view.ttlPunctuation'}}</h3></header>
<div>{{#ifCond CopyPunctuation '==' 'true'}}{{ t 'view.lblCopyPunctuation'}}{{else}}{{ t 'view.lblNoPunctuationCopy'}}{{/ifCond}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="Cases">
<a id="Cases" href="#project/{{this.projectid}}/7">
<header><h3>{{t 'view.ttlCases'}}</h3></header>
<div>{{#ifCond AutoCapitalization '==' 'true'}}{{ t 'view.lblAutoCapitalize'}}{{else}}{{ t 'view.lblNoAutoCapitalization'}}{{/ifCond}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
</li>
<li class="topcoat-list__item">
<a id="Filtering">
<a id="Filtering" href="#project/{{this.projectid}}/8">
<header><h3>{{t 'view.ttlFilter'}}</h3></header>
<div>{{#ifCond CustomFilters '==' 'true'}}{{ t 'view.lblCustomFilters'}}{{else}}{{ t 'view.lblFilteringDefault'}}{{/ifCond}}</div>
<span class="chevron" style="top:1.25rem;"></span></a>
Expand Down
2 changes: 1 addition & 1 deletion www/tpl/TargetUnitList.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}}
<div class="topcoat-navigation-bar main_title bg-lightblue">
<div class="topcoat-navigation-bar__item">
<a class="topcoat-icon-button--quiet back-button" aria-label="{{ t 'view.dscBack'}}" href="index.html"><span class="topcoat-icon topcoat-icon--back"></span></a>
<a class="topcoat-icon-button--quiet back-button" aria-label="{{ t 'view.dscBack'}}"><span class="topcoat-icon topcoat-icon--back"></span></a>
</div>
<div class="topcoat-navigation-bar__item half"><h2>{{t 'view.lblKB'}}</h2></div>
<div class="topcoat-navigation-bar__item right">
Expand Down

0 comments on commit 33dd0e7

Please sign in to comment.