Skip to content

Commit 141ed73

Browse files
Merge branch 'fixReasonField340-894' into 'main'
Corrige visibilidade do campo de justificativa de não-disponibilidade - 3.4.0 See merge request softwares-pkp/plugins_ojs/dataverse!217
2 parents f698099 + 04dbaa0 commit 141ed73

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

cypress/tests/Test1_submissionWizard.cy.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ describe('Dataverse Plugin - Submission wizard features', function () {
5959
cy.contains('h2', 'Data statement');
6060
cy.get('#dataStatement-dataStatementUrls-control').should('not.be.visible');
6161
cy.get('#dataStatement-dataStatementReason-control-en').should('not.be.visible');
62+
cy.get('form[dataversepluginapiurl]').within(() => {
63+
cy.get('div.pkpFormLocales').should('not.be.visible');
64+
});
6265

6366
cy.get('input[name="dataStatementTypes"][value=2]').click();
6467
cy.contains('Insert the URLs to the data');
@@ -84,6 +87,9 @@ describe('Dataverse Plugin - Submission wizard features', function () {
8487
cy.get('input[name="dataStatementTypes"][value=5]').click();
8588
cy.contains('Provide the justification for the unavailability of the data');
8689
cy.get('#dataStatement-dataStatementReason-control-en').should('be.visible');
90+
cy.get('form[dataversepluginapiurl]').within(() => {
91+
cy.get('div.pkpFormLocales').should('be.visible');
92+
});
8793
advanceNSteps(4);
8894
cy.contains('It is required to inform the justification for the unavailability of the data');
8995

cypress/tests/Test6_CustomRequiredMetadataFields.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe('Dataverse Plugin - Custom required metadata fields', function () {
198198

199199
it('Submit dataset with custom required metadata fields in workflow page', function () {
200200
if (Cypress.env('contextTitles').en !== 'Public Knowledge Preprint Server') {
201-
cy.changeAuthorEditPermissionOnPublication('dbarnes', null, 'Elinor Ostrom', 'publicknowledge', 'check');
201+
cy.changeAuthorEditPermissionOnPublication('dbarnes', 'Elinor Ostrom', 'publicknowledge', submission.title, 'check');
202202
}
203203

204204
cy.login('eostrom', null, 'publicknowledge');

js/ui/components/DataStatementForm.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,36 @@ pkp.Vue.component('data-statement-form', {
7474
});
7575

7676
function addEventListeners() {
77+
let currentUrl = window.location.href;
78+
let formLocalesControl = document.querySelector('form[dataversepluginapiurl] div.pkpFormLocales');
79+
80+
if (currentUrl.includes('workflow') || currentUrl.includes('authorDashboard')) {
81+
formLocalesControl = document.querySelector('#dataStatement div.pkpFormLocales');
82+
}
83+
7784
let checkRepoAvailable = document.querySelectorAll('input[name="dataStatementTypes"][value="' + pkp.const.DATA_STATEMENT_TYPE_REPO_AVAILABLE + '"]')[0];
7885
let checkPublicUnavailable = document.querySelectorAll('input[name="dataStatementTypes"][value="' + pkp.const.DATA_STATEMENT_TYPE_PUBLICLY_UNAVAILABLE + '"]')[0];
7986
let checkDataverseSubmitted = document.querySelectorAll('input[name="dataStatementTypes"][value="' + pkp.const.DATA_STATEMENT_TYPE_DATAVERSE_SUBMITTED + '"]')[0];
8087

8188
let dataStatementUrlsField = document.getElementById('dataStatement-dataStatementUrls-description').parentNode;
8289
let dataStatementReasonField = document.querySelectorAll('[id^="dataStatement-dataStatementReason-description"')[0].parentNode;
83-
let currentUrl = window.location.href;
8490

8591
dataStatementUrlsField.hidden = !checkRepoAvailable.checked;
8692
dataStatementReasonField.hidden = !checkPublicUnavailable.checked;
93+
formLocalesControl.hidden = !checkPublicUnavailable.checked;
8794

8895
checkRepoAvailable.addEventListener('change', function() {
8996
dataStatementUrlsField.hidden = !this.checked;
9097
});
9198

9299
checkPublicUnavailable.addEventListener('change', function() {
100+
if (!this.checked) {
101+
let currentLocaleButton = formLocalesControl.querySelector('button.pkpFormLocales__locale--isActive');
102+
if (currentLocaleButton) {
103+
currentLocaleButton.click();
104+
}
105+
}
106+
formLocalesControl.hidden = !this.checked;
93107
dataStatementReasonField.hidden = !this.checked;
94108
});
95109

version.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<version>
1414
<application>dataverse</application>
1515
<type>plugins.generic</type>
16-
<release>3.4.0.0</release>
17-
<date>2026-02-11</date>
16+
<release>3.4.0.1</release>
17+
<date>2026-04-06</date>
1818
<lazy-load>1</lazy-load>
1919
<class>DataversePlugin</class>
2020
</version>

0 commit comments

Comments
 (0)