Skip to content

Commit

Permalink
I9992 (#4339)
Browse files Browse the repository at this point in the history
* pkp/pkp-lib#9992 Migrate issue stats modal to side modal

* pkp/pkp-lib#9992 Migrate workflow page modal to side modal

* pkp/pkp-lib#9992 Update locale keys

* pkp/pkp-lib#9992 adjust cypress tests for side modal
  • Loading branch information
jardakotesovec authored Jul 2, 2024
1 parent 7db52c8 commit 6eac08d
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 98 deletions.
50 changes: 25 additions & 25 deletions cypress/tests/data/60-content/AmwandengaSubmission.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('Data suite: Amwandenga', function() {
'genre': Cypress.env('defaultGenre')
}]);
cy.get('.listPanel__item:contains("delete-this-file.pdf")').find('button').contains('Remove').click();
cy.get('.modal__panel:contains("Are you sure you want to remove this file?")').find('button').contains('Yes').click();
cy.get('div[role=dialog]:contains("Are you sure you want to remove this file?")').find('button').contains('Yes').click();
cy.get('.listPanel__item:contains("delete-this-file.pdf")').should('not.exist');

cy.get('.submissionWizard__footer button').contains('Continue').click();
Expand All @@ -143,45 +143,45 @@ describe('Data suite: Amwandenga', function() {
cy.get('h2').contains('Contributors');
cy.get('.listPanel__item:contains("Alan Mwandenga")');
cy.get('button').contains('Add Contributor').click();
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('div[role=dialog]:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('#contributor-givenName-error-en').contains('This field is required.');
cy.get('#contributor-email-error').contains('This field is required.');
cy.get('#contributor-country-error').contains('This field is required.');
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="-en"]').type(submission.authors[0].givenName);
cy.get('.pkpFormField:contains("Family Name")').find('input[name*="-en"]').type(submission.authors[0].familyName);
cy.get('.pkpFormField:contains("Country")').find('select').select(submission.authors[0].country)
cy.get('.pkpFormField:contains("Email")').find('input').type('notanemail');
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('div[role=dialog]:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('#contributor-email-error').contains('This is not a valid email address.');
cy.get('.pkpFormField:contains("Email")').find('input').type(submission.authors[0].email);
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('div[role=dialog]:contains("Add Contributor")').find('button').contains('Save').click();
cy.wait(3000);
cy.get('button').contains('Order').click();
cy.wait(3000);
cy.get('button:contains("Decrease position of Alan Mwandenga")').click();
cy.get('button').contains('Save Order').click();
cy.get('button:contains("Preview")').click(); // Will only appear after order is saved
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Abbreviated")').contains('Mansour et al.');
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Publication Lists")').contains('Amina Mansour, Alan Mwandenga (Author)');
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Full")').contains('Amina Mansour, Alan Mwandenga (Author)');
cy.get('.modal__panel:contains("List of Contributors")').find('.modal__closeButton').click();
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Abbreviated")').contains('Mansour et al.');
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Publication Lists")').contains('Amina Mansour, Alan Mwandenga (Author)');
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Full")').contains('Amina Mansour, Alan Mwandenga (Author)');
cy.get('div[role=dialog]:contains("List of Contributors")').find('button:contains("Close")').click();
cy.get('.listPanel:contains("Contributors")').find('button').contains('Order').click();
cy.get('button:contains("Increase position of Alan Mwandenga")').click();
cy.get('.listPanel:contains("Contributors")').find('button').contains('Save Order').click();
cy.get('.listPanel:contains("Contributors") button:contains("Preview")').click(); // Will only appear after order is saved
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Abbreviated")').contains('Mwandenga et al.');
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Publication Lists")').contains('Alan Mwandenga, Amina Mansour (Author)');
cy.get('.modal__panel:contains("List of Contributors")').find('tr:contains("Full")').contains('Alan Mwandenga, Amina Mansour (Author)');
cy.get('.modal__panel:contains("List of Contributors")').find('.modal__closeButton').click();
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Abbreviated")').contains('Mwandenga et al.');
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Publication Lists")').contains('Alan Mwandenga, Amina Mansour (Author)');
cy.get('div[role=dialog]:contains("List of Contributors")').find('tr:contains("Full")').contains('Alan Mwandenga, Amina Mansour (Author)');
cy.get('div[role=dialog]:contains("List of Contributors")').find('button:contains("Close")').click();

// Delete a contributor
cy.get('.listPanel:contains("Contributors")').find('button').contains('Add Contributor').click();
cy.get('.pkpFormField:contains("Given Name")').find('input[name*="-en"]').type('Fake Author Name');
cy.get('.pkpFormField:contains("Email")').find('input').type('[email protected]');
cy.get('.pkpFormField:contains("Country")').find('select').select('Barbados');
cy.get('.modal__panel:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('div[role=dialog]:contains("Add Contributor")').find('button').contains('Save').click();
cy.get('.listPanel__item:contains("Fake Author Name")').find('button').contains('Delete').click();
cy.get('.modal__panel:contains("Are you sure you want to remove Fake Author Name as a contributor?")').find('button').contains('Delete Contributor').click();
cy.get('div[role=dialog]:contains("Are you sure you want to remove Fake Author Name as a contributor?")').find('button').contains('Delete Contributor').click();
cy.get('.listPanel__item:contains("Fake Author Name")').should('not.exist');

cy.get('.submissionWizard__footer button').contains('Continue').click();
Expand Down Expand Up @@ -247,7 +247,7 @@ describe('Data suite: Amwandenga', function() {
cy.contains('Make a Submission: Review');
cy.get('button:contains("Submit")').click();
const message = 'The submission, ' + submission.title + ', will be submitted to ' + Cypress.env('contextTitles').en + ' for editorial review';
cy.get('.modal__panel:contains("' + message + '")').find('button').contains('Submit').click();
cy.get('div[role=dialog]:contains("' + message + '")').find('button').contains('Submit').click();
cy.contains('Submission complete');
cy.get('a').contains('Create a new submission');
cy.get('a').contains('Return to your dashboard');
Expand Down Expand Up @@ -339,11 +339,11 @@ describe('Data suite: Amwandenga', function() {

cy.get('#contributors button').contains('Add Contributor').click();

cy.get('.modal [name="givenName-en"]').type('Nicolas', {delay: 0});
cy.get('.modal [name="familyName-en"]').type('Riouf', {delay: 0});
cy.get('.modal [name="email"]').type('[email protected]', {delay: 0});
cy.get('.modal [name="country"]').select('South Africa');
cy.get('.modal button').contains('Save').click();
cy.get('div[role="dialog"] [name="givenName-en"]').type('Nicolas', {delay: 0});
cy.get('div[role="dialog"] [name="familyName-en"]').type('Riouf', {delay: 0});
cy.get('div[role="dialog"] [name="email"]').type('[email protected]', {delay: 0});
cy.get('div[role="dialog"] [name="country"]').select('South Africa');
cy.get('div[role="dialog"] button').contains('Save').click();
cy.wait(500);
cy.get('#contributors div').contains('Nicolas Riouf');

Expand Down Expand Up @@ -426,7 +426,7 @@ describe('Data suite: Amwandenga', function() {
cy.get('#publication-button').click();
cy.get('button').contains('Unpublish').click();
cy.contains('Are you sure you don\'t want this to be published?');
cy.get('.modal__panel button').contains('Unpublish').click();
cy.get('div[role=dialog] button').contains('Unpublish').click();
cy.wait(1000);
cy.visit('/index.php/publicknowledge/issue/current');
cy.contains('Signalling Theory Dividends').should('not.exist');
Expand Down Expand Up @@ -455,7 +455,7 @@ describe('Data suite: Amwandenga', function() {
cy.get('#titleAbstract button').contains('Save').should('be.disabled');
cy.get('#publication button').contains('Create New Version').click();
cy.contains('Are you sure you want to create a new version?');
cy.get('.modal__panel:contains("Create New Version")').get('button').contains('Yes').click();
cy.get('div[role=dialog]:contains("Create New Version")').get('button').contains('Yes').click();
cy.wait(3000);

// Toggle between versions
Expand All @@ -480,8 +480,8 @@ describe('Data suite: Amwandenga', function() {
cy.get('#contributors-button').click();

cy.get('#contributors div').contains('Alan Mwandenga').parent().parent().find('button').contains('Edit').click();
cy.get('.modal [name="familyName-en"]').type(' Version 2', {delay: 0});
cy.get('.modal button').contains('Save').click();
cy.get('div[role="dialog"] [name="familyName-en"]').type(' Version 2', {delay: 0});
cy.get('div[role="dialog"] button').contains('Save').click();
// cy.get('#contributors button').contains('Save').should("not.be.visible");
cy.wait(1500); // Wait for the grid to reload
cy.get('#contributors div').contains('Alan Mwandenga Version 2');
Expand Down Expand Up @@ -534,7 +534,7 @@ describe('Data suite: Amwandenga', function() {
cy.get('#publication-button').click();
cy.get('button').contains('Unpublish').click();
cy.contains('Are you sure you don\'t want this to be published?');
cy.get('.modal__panel button').contains('Unpublish').click();
cy.get('div[role=dialog] button').contains('Unpublish').click();
cy.wait(1000);
cy.get('.pkpWorkflow__header a').contains('View').click();
cy.contains('The Signalling Theory Dividends Version 2').should('not.exist');
Expand Down
6 changes: 3 additions & 3 deletions cypress/tests/integration/SubmissionWizard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ describe('Submission Wizard', function() {
// Change submission language to French (Canada) and section to Reviews
cy.contains('Submitting to the Articles section in English');
cy.get('button:contains("Change")').click();
cy.get('h2:contains("Change Submission Settings")')
.parents('.modal')
cy.get('h1:contains("Change Submission Settings")')
.parents('[role=dialog]')
.within(() => {
cy.get('label:contains("French (Canada)")').click();
cy.get('label:contains("Reviews")').click();
Expand Down Expand Up @@ -586,7 +586,7 @@ describe('Submission Wizard', function() {
.click();
cy.get('input[name="givenName-fr_CA"]').type('Carlo', {delay: 0});
cy.get('input[name="familyName-fr_CA"]').type('Carlo', {delay: 0});
cy.get('.modal').find('button:contains("Save")').click();
cy.get('[role=dialog]').find('button:contains("Save")').click();
cy.get('.pkpSteps button:contains("For the Editors")').click();
cy.get('#forTheEditors-subjects-control-fr_CA').type('Sociologie française', {delay: 0});
cy.get('li:contains("Sociologie française")');
Expand Down
48 changes: 48 additions & 0 deletions registry/uiLocaleKeysBackend.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[
"article.article",
"author.users.contributor.principalContact",
"author.users.contributor.setPrincipalContact",
"common.abstract",
"common.addCCBCC",
"common.attachFiles",
Expand All @@ -9,6 +11,7 @@
"common.close",
"common.commaListSeparator",
"common.content",
"common.default",
"common.delete",
"common.description",
"common.deselect",
Expand All @@ -22,6 +25,7 @@
"common.filterRemove",
"common.filtersClear",
"common.findTemplate",
"common.geographic",
"common.insert",
"common.insertContent",
"common.insertContentSearch",
Expand All @@ -42,12 +46,15 @@
"common.pagination.label",
"common.pagination.next",
"common.pagination.previous",
"common.publications",
"common.remove",
"common.removeItem",
"common.required",
"common.reset",
"common.save",
"common.saving",
"common.search",
"common.searchPhrase",
"common.searching",
"common.selectAll",
"common.selectNone",
Expand All @@ -66,6 +73,14 @@
"common.view",
"common.viewWithName",
"common.yes",
"context.context",
"contributor.listPanel.preview",
"contributor.listPanel.preview.abbreviated",
"contributor.listPanel.preview.description",
"contributor.listPanel.preview.display",
"contributor.listPanel.preview.format",
"contributor.listPanel.preview.full",
"contributor.listPanel.preview.publicationLists",
"dashboard.acceptOrDeclineRequestDate",
"dashboard.action",
"dashboard.applyFilters",
Expand Down Expand Up @@ -172,6 +187,7 @@
"editor.review.unassignReviewer",
"editor.submission.addStageParticipant",
"editor.submission.decision.requestRevisions",
"editor.submission.revisions",
"editor.submission.schedulePublication",
"editor.submission.search",
"editor.submissionArchive.confirmDelete",
Expand All @@ -192,6 +208,11 @@
"form.multilingualLabel",
"form.multilingualProgress",
"form.saved",
"grid.action.addContributor",
"grid.action.deleteContributor",
"grid.action.deleteContributor.confirmationMessage",
"grid.action.edit",
"grid.action.saveOrdering",
"grid.action.sort",
"help.help",
"invitation.orcid.message",
Expand All @@ -203,6 +224,7 @@
"invitation.role.selectRole",
"invitation.wizard.completeSteps",
"issue.issue",
"issue.issues",
"list.collapseAll",
"list.expandAll",
"list.viewLess",
Expand Down Expand Up @@ -259,6 +281,11 @@
"manager.dois.update.failedCreation",
"manager.dois.update.partialFailure",
"manager.dois.update.success",
"manager.emails.addEmail",
"manager.export.usersToCsv.label",
"manager.mailables.addTemplates",
"manager.mailables.editTemplate",
"manager.mailables.templates",
"metadata.property.displayName.doi",
"navigation.backTo",
"orcid.field.authorEmailModal.message",
Expand Down Expand Up @@ -316,8 +343,28 @@
"reviewer.submission.submittedOn",
"search.searchResults",
"stageParticipants.notify.message",
"stats.context.downloadReport.description",
"stats.context.downloadReport.downloadContext",
"stats.context.downloadReport.downloadContext.description",
"stats.countWithYearlyAverage",
"stats.dateRange",
"stats.descriptionForStat",
"stats.geographic.ccAttribution",
"stats.geographic.tooltip.label",
"stats.issues.downloadReport.description",
"stats.issues.downloadReport.downloadIssues",
"stats.issues.downloadReport.downloadIssues.description",
"stats.publications.downloadReport.description",
"stats.publications.downloadReport.downloadFiles",
"stats.publications.downloadReport.downloadFiles.description",
"stats.publications.downloadReport.downloadGeographic",
"stats.publications.downloadReport.downloadGeographic.description",
"stats.publications.downloadReport.downloadSubmissions",
"stats.publications.downloadReport.downloadSubmissions.description",
"stats.timeline",
"stats.timeline.downloadReport.downloadTimeline",
"submission.contributors",
"submission.files",
"submission.list.assignEditor",
"submission.list.copyeditsSubmitted",
"submission.list.currentStage",
Expand All @@ -336,6 +383,7 @@
"submission.list.revisionsSubmitted",
"submission.submit.newSubmissionSingle",
"submission.upload.percentComplete",
"submission.wizard.changeSubmission",
"submissions.declined",
"submissions.incomplete",
"todo",
Expand Down
49 changes: 1 addition & 48 deletions templates/stats/issues.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -136,57 +136,10 @@
</a>
</div>
<pkp-button
@click="isModalOpenedDownloadReport = true"
@click="openDownloadReportModal"
>
{translate key="common.downloadReport"}
</pkp-button>
<modal
close-label="{translate key="common.close"}"
name="downloadReport"
title={translate key="common.download"}
:open="isModalOpenedDownloadReport"
@close="isModalOpenedDownloadReport = false"
>
<p>{translate key="stats.issues.downloadReport.description"}</p>
<table class="pkpTable pkpStats__reportParams">
<tr class="pkpTable__row">
<th>{translate key="stats.dateRange"}</th>
<td>{{ getDateRangeDescription() }}</th>
</tr>
<tr
v-if="searchPhrase"
class="pkpTable__row">
<th>{translate key="common.searchPhrase"}</th>
<td>{{ searchPhrase }}</th>
</tr>
</table>
<action-panel class="pkpStats__reportAction">
<h2>{translate key="issue.issues"}</h2>
<p>
{translate key="stats.issues.downloadReport.downloadIssues.description"}
</p>
<template #actions>
<pkp-button
@click="downloadReport"
>
{translate key="stats.issues.downloadReport.downloadIssues"}
</pkp-button>
</template>
</action-panel>
<action-panel class="pkpStats__reportAction">
<h2>{translate key="stats.timeline"}</h2>
<p>
{{ getTimelineDescription() }}
</p>
<template #actions>
<pkp-button
@click="downloadReport('timeline')"
>
{translate key="stats.timeline.downloadReport.downloadTimeline"}
</pkp-button>
</template>
</action-panel>
</modal>
</template>
</pkp-header>
<pkp-table
Expand Down
22 changes: 0 additions & 22 deletions templates/workflow/workflow.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,6 @@
{capture assign=submissionProgressBarUrl}{url op="submissionProgressBar" submissionId=$submission->getId() stageId=$requestedStageId contextId="submission" escape=false}{/capture}
{load_url_in_div id="submissionProgressBarDiv" url=$submissionProgressBarUrl}
</div>

{* Modal to select one of the revision decisions *}
<modal
:close-label="t('common.close')"
name="selectRevisionDecision"
title="Revisions"
:open="isModalOpenedSelectRevisionDecision"
@close="isModalOpenedSelectRevisionDecision = false"
>
<pkp-form v-bind="components.{$smarty.const.FORM_SELECT_REVISION_DECISION}" @set="set" @success="goToRevisionDecision" />
</modal>

{* Modal to select one of the revision recommendations *}
<modal
:close-label="t('common.close')"
name="selectRevisionRecommendation"
title="Revisions"
:open="isModalOpenedSelectRevisionRecommendation"
@close="isModalOpenedSelectRevisionRecommendation = false"
>
<pkp-form v-bind="components.{$smarty.const.FORM_SELECT_REVISION_RECOMMENDATION}" @set="set" @success="goToRevisionDecision" />
</modal>
</tab>
{if $canAccessPublication}
<tab id="publication" label="{translate key="submission.publication"}">
Expand Down

0 comments on commit 6eac08d

Please sign in to comment.