Skip to content

Commit

Permalink
Change submission language
Browse files Browse the repository at this point in the history
  • Loading branch information
jyhein committed Sep 3, 2024
1 parent 11beda6 commit 4694cef
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 0 deletions.
75 changes: 75 additions & 0 deletions cypress/tests/integration/ChangeSubmissionLanguage.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* @file cypress/tests/integration/ChangeSubmissionLanguage.cy.js
*
* Copyright (c) 2023 Simon Fraser University
* Copyright (c) 2023 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*/

describe('Change Submission Language', function() {
let user;
let author;
let password;
let originalLanguage;
let originalLocaleKey;
let newLanguage;
let newLocaleKey;
let title;
let abstract;

before(function() {
user = 'dbarnes';
password = user + user;
author = {
familyName: 'Karbasizaed',
}
originalLanguage = 'English';
originalLocaleKey = 'en';
newLanguage = 'French (Canada)';
newLocaleKey = 'fr_CA';
title = {
[newLocaleKey]: "Résistance aux antimicrobiens et aux métaux lourds et profil plasmidique des coliformes isolés d'infections nosocomiales dans un hôpital d'Ispahan, Iran",
};
abstract = {
[newLocaleKey]: "Les profils de résistance aux antimicrobiens et aux métaux lourds ainsi que les profils plasmidiques des coliformes (Enterobacteriacea) isolés d'infections nosocomiales et de matières fécales humaines saines ont été comparés. Quinze des 25 isolats provenant d'infections nosocomiales ont été identifiés comme étant des Escherichia coli, et les autres comme étant des Kelebsiella pneumoniae. Soixante-douze pour cent des souches isolées d'infections nosocomiales possèdent une résistance multiple aux antibiotiques, contre 45 % des souches provenant de matières fécales humaines saines. La différence entre les valeurs de concentration minimale inhibitrice (CMI) des souches provenant de cas cliniques et de matières fécales pour quatre métaux lourds (Hg, Cu, Pb, Cd) n'était pas significative. Cependant, la plupart des souches isolées à l'hôpital étaient plus tolérantes aux métaux lourds que celles provenant de personnes en bonne santé. Il n'y avait pas de relation cohérente entre le groupe de profil plasmidique et le profil de résistance aux antimicrobiens, bien qu'un plasmide conjugatif (>56,4 kb) codant pour la résistance aux métaux lourds et aux antibiotiques ait été récupéré chez huit des souches isolées d'infections nosocomiales. Les résultats indiquent que les coliformes multirésistants sont une cause potentielle d'infection nosocomiale dans cette région.",
};
});

it('Try to change submission language after publication', function() {
cy.login(user, password, 'publicknowledge');
cy.get('button[id="archive-button"]').click();
cy.contains('View ' + author.familyName).click({force: true});
cy.get(`.pkpPublication__changeSubmissionLanguage > button`).should('be.disabled');
});

it('Change submission language', function() {
cy.login(user, password, 'publicknowledge');
cy.get('button[id="archive-button"]').click();
cy.contains('View ' + author.familyName).click({force: true});
// Unpublish
cy.get('button[id="publication-button"]').click();
cy.get('#publication button:contains("Unpublish")').click();
cy.get('#headlessui-dialog-panel-5 button:contains("Unpublish")').click();
// Change language
cy.get(`.pkpPublication__changeSubmissionLanguage > button`).should('be.enabled').click();
cy.get('#changeSubmissionLanguage').find(`input[value="${newLocaleKey}"]`).click();
cy.setTinyMceContent('changeSubmissionLanguageMetadata-title-control', title[newLocaleKey]);
cy.setTinyMceContent('changeSubmissionLanguageMetadata-abstract-control', abstract[newLocaleKey]);
cy.get('#changeSubmissionLanguage button[label="Confirm"]').click();
cy.get(`.pkpPublication__changeSubmissionLanguage > span`).contains(`Current Submission Language: ${newLanguage}`);
});

it('Change submission language back to the original', function() {
cy.findSubmissionAsEditor(user, password, author.familyName);
// Change language
cy.get('button[id="publication-button"]').click();
cy.get(`.pkpPublication__changeSubmissionLanguage > button`).click();
cy.get('#changeSubmissionLanguage').find(`input[value="${originalLocaleKey}"]`).click();
cy.get('#changeSubmissionLanguage button[label="Confirm"]').click();
// Publish
cy.get(`.pkpPublication__changeSubmissionLanguage > span`).contains(`Current Submission Language: ${originalLanguage}`);
cy.get('button[id="publication-button"]').click();
cy.get('div#publication button:contains("Schedule For Publication")').click();
cy.get('div.pkpWorkflow__publishModal button:contains("Publish")').click();
});
});
1 change: 1 addition & 0 deletions registry/uiLocaleKeysBackend.json
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
"submission.contributors",
"submission.files",
"submission.list.assignEditor",
"submission.list.changeSubmissionLanguage.title",
"submission.list.copyeditsSubmitted",
"submission.list.currentStage",
"submission.list.discussions",
Expand Down
8 changes: 8 additions & 0 deletions templates/authorDashboard/authorDashboard.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
);
{rdelim});
</script>
<pkp-header class="pkpPublication__header" :is-one-line="false">
<span class="pkp_submission_workflow__changeSubmissionLanguage">
{translate key="submission.list.changeSubmissionLanguage.currentLanguage" language="{{ currentSubmissionLanguageLabel }}"}
</span>
</pkp-header>
<div id="stageTabs" class="pkp_controllers_tab">
<ul>
{foreach from=$workflowStages item=stage}
Expand All @@ -77,6 +82,9 @@
<tab id="publication" label="{translate key="submission.publication"}">
<div class="pkpPublication" ref="publication" aria-live="polite">
<pkp-header class="pkpPublication__header" :is-one-line="false">
<span class="pkpPublication__changeSubmissionLanguage">
{translate key="submission.list.changeSubmissionLanguage.currentLanguage" language="{{ currentSubmissionLanguageLabel }}"}
</span>
<span class="pkpPublication__status">
<strong>{{ statusLabel }}</strong>
<span v-if="workingPublication.status === getConstant('STATUS_QUEUED') && workingPublication.id === currentPublication.id" class="pkpPublication__statusUnpublished">{translate key="publication.status.unscheduled"}</span>
Expand Down
21 changes: 21 additions & 0 deletions templates/workflow/workflow.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
{rdelim});
</script>

<pkp-header class="pkpPublication__header" :is-one-line="false">
<span class="pkp_submission_workflow__changeSubmissionLanguage">
{translate key="submission.list.changeSubmissionLanguage.currentLanguage" language="{{ currentSubmissionLanguageLabel }}"}
</span>
</pkp-header>
<div id="submissionWorkflow" class="pkp_submission_workflow">
{include file="controllers/notification/inPlaceNotification.tpl" notificationId="workflowNotification" requestOptions=$workflowNotificationRequestOptions}
{capture assign=submissionProgressBarUrl}{url op="submissionProgressBar" submissionId=$submission->getId() stageId=$requestedStageId contextId="submission" escape=false}{/capture}
Expand All @@ -98,6 +103,16 @@
{help file="editorial-workflow/publication" class="pkp_help_tab"}
<div class="pkpPublication" ref="publication" aria-live="polite">
<pkp-header class="pkpPublication__header" :is-one-line="false">
<span class="pkpPublication__changeSubmissionLanguage">
<span>{translate key="submission.list.changeSubmissionLanguage.currentLanguage" language="{{ currentSubmissionLanguageLabel }}"}</span>
<pkp-button
:disabled="!canChangeSubmissionLanguage || publicationList.length > 1 || submission.status === getConstant('STATUS_PUBLISHED')"
@click="openChangeSubmissionLanguageModal"
:is-link="true"
>
{translate key="submission.list.changeSubmissionLanguage.buttonLabel"}
</pkp-button>
</span>
<span class="pkpPublication__status">
<strong>{{ statusLabel }}</strong>
<span v-if="workingPublication.status === getConstant('STATUS_QUEUED') && workingPublication.id === currentPublication.id" class="pkpPublication__statusUnpublished">{translate key="publication.status.unscheduled"}</span>
Expand Down Expand Up @@ -176,6 +191,12 @@
>
{translate key="publication.editDisabled"}
</div>
<div
v-if="workingPublication.status !== getConstant('STATUS_PUBLISHED') && !submissionSupportedLocales.includes(submission.locale)"
class="pkpSubmission__localeNotSupported"
>
{translate key="submission.localeNotSupported" language="{{ currentSubmissionLanguageLabel }}"}
</div>
<tabs class="pkpPublication__tabs" :is-side-tabs="true" :track-history="true" :label="currentPublicationTabsLabel">
<tab id="titleAbstract" label="{translate key="publication.titleAbstract"}">
<pkp-form v-bind="components.{PKP\components\forms\publication\TitleAbstractForm::FORM_TITLE_ABSTRACT}" @set="set" />
Expand Down

0 comments on commit 4694cef

Please sign in to comment.