From c0c8d83c5403b0f997d5118ad752dd4080292da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Pr=C3=A9vost?= Date: Mon, 25 Mar 2024 18:58:10 -0400 Subject: [PATCH] Fix revisions loading bug and removed translation button --- .../translation-edit/helpers/component.ts | 2 ++ .../logged-in/project/translation/editions.ts | 2 +- .../logged-in/project/translation/editions.ts | 2 +- .../related-translations-list/item.hbs | 6 ++--- .../templates/components/translation-edit.hbs | 26 ++++++++++--------- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/webapp/app/components/translation-edit/helpers/component.ts b/webapp/app/components/translation-edit/helpers/component.ts index 40f06625..5a4b3872 100644 --- a/webapp/app/components/translation-edit/helpers/component.ts +++ b/webapp/app/components/translation-edit/helpers/component.ts @@ -6,6 +6,8 @@ interface Args { export default class TranslationEditHelpers extends Component { get machineTranslationLanguages() { + if (!this.args.revisions) return []; + return this.args.revisions.map((revision: any) => ({ name: revision.name || revision.language.name, slug: revision.slug || revision.language.slug diff --git a/webapp/app/controllers/logged-in/project/translation/editions.ts b/webapp/app/controllers/logged-in/project/translation/editions.ts index f4bf31c8..0347d67c 100644 --- a/webapp/app/controllers/logged-in/project/translation/editions.ts +++ b/webapp/app/controllers/logged-in/project/translation/editions.ts @@ -29,7 +29,7 @@ export default class TranslationEditionsController extends Controller { @readOnly('globalState.permissions') permissions: any; - @readOnly('model.revisionModel.project.revisions') + @readOnly('model.translationModel.revisions') revisions: any; @equal('model.translations', undefined) diff --git a/webapp/app/routes/logged-in/project/translation/editions.ts b/webapp/app/routes/logged-in/project/translation/editions.ts index b8a4b45d..50d3ec40 100644 --- a/webapp/app/routes/logged-in/project/translation/editions.ts +++ b/webapp/app/routes/logged-in/project/translation/editions.ts @@ -31,7 +31,7 @@ export default class TranslationEditionsRoute extends Route { translationEditionsQuery, { props: (data) => ({ - revisionModel: this.modelFor('logged-in.project.revision'), + translationModel: this.modelFor('logged-in.project.translation'), project: data.viewer.project, prompts: data.viewer.project.prompts, translations: data.viewer.project.translation.editions diff --git a/webapp/app/templates/components/related-translations-list/item.hbs b/webapp/app/templates/components/related-translations-list/item.hbs index 02ef5796..4e1632ee 100644 --- a/webapp/app/templates/components/related-translations-list/item.hbs +++ b/webapp/app/templates/components/related-translations-list/item.hbs @@ -66,10 +66,10 @@ @onUpdateText={{fn this.onUpdateText}} /> + + {{t 'components.related_translations_list.save_button'}} + {{/unless}} - - {{t 'components.related_translations_list.save_button'}} - {{/component}} diff --git a/webapp/app/templates/components/translation-edit.hbs b/webapp/app/templates/components/translation-edit.hbs index b3a259cc..e909f193 100644 --- a/webapp/app/templates/components/translation-edit.hbs +++ b/webapp/app/templates/components/translation-edit.hbs @@ -17,18 +17,20 @@ lang={{this.revisionSlug}} /> -
- -
+ {{#unless @translation.isRemoved}} +
+ +
+ {{/unless}} {{/if}}