-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'deleteUnpostedVersions-598' into 'main'
Permite a exclusão de versões See merge request softwares-pkp/plugins_ojs/authorVersion!11
- Loading branch information
Showing
10 changed files
with
245 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use PKP\components\forms\FormComponent; | ||
use PKP\components\forms\FieldHTML; | ||
|
||
define('FORM_DELETE_VERSION', 'deleteVersionForm'); | ||
|
||
class DeleteVersionForm extends FormComponent | ||
{ | ||
public function __construct($action) | ||
{ | ||
$this->id = FORM_DELETE_VERSION; | ||
$this->action = $action; | ||
$this->method = 'POST'; | ||
|
||
$this->addPage([ | ||
'id' => 'default', | ||
'submitButton' => [ | ||
'label' => __('common.delete') | ||
], | ||
]); | ||
$this->addGroup([ | ||
'id' => 'default', | ||
'pageId' => 'default', | ||
]); | ||
$this->addField(new FieldHTML('confirmation', [ | ||
'description' => __('plugins.generic.authorVersion.deleteVersion.confirmation'), | ||
'groupId' => 'default', | ||
])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
describe('Author Version - Delete versions', function () { | ||
let submissionData; | ||
|
||
before(function() { | ||
submissionData = { | ||
'title': 'Submission for testing deleting of versions', | ||
'abstract': 'Just a simple abstract', | ||
'keywords': ['plugin', 'testing', 'delete'] | ||
} | ||
}); | ||
|
||
function step1() { | ||
cy.get('input[id^="checklist-"]').click({ multiple: true }); | ||
cy.get('input[id=privacyConsent]').click(); | ||
cy.get('button.submitFormButton').click(); | ||
} | ||
|
||
function step2() { | ||
cy.get('#submitStep2Form button.submitFormButton').click(); | ||
} | ||
|
||
function step3() { | ||
cy.get('input[name^="title"]').first().type(submissionData.title, { delay: 0 }); | ||
cy.get('label').contains('Title').click(); | ||
cy.get('textarea[id^="abstract-"').then((node) => { | ||
cy.setTinyMceContent(node.attr("id"), submissionData.abstract); | ||
}); | ||
cy.get('.section > label:visible').first().click(); | ||
cy.get('ul[id^="en_US-keywords-"]').then(node => { | ||
node.tagit('createTag', submissionData.keywords[0]); | ||
node.tagit('createTag', submissionData.keywords[1]); | ||
}); | ||
|
||
cy.get('#submitStep3Form button.submitFormButton').click(); | ||
} | ||
|
||
function step4() { | ||
cy.waitJQuery(); | ||
cy.get('#submitStep4Form button.submitFormButton').click(); | ||
cy.get('button.pkpModalConfirmButton').click(); | ||
} | ||
|
||
it('Author - Creates new submission', function () { | ||
cy.login('fpaglieri', null, 'publicknowledge'); | ||
cy.get('div#myQueue a:contains("New Submission")').click(); | ||
|
||
step1(); | ||
step2(); | ||
step3(); | ||
step4(); | ||
|
||
cy.waitJQuery(); | ||
cy.get('h2:contains("Submission complete")'); | ||
}); | ||
it("Moderator - Can't delete first version", function () { | ||
cy.findSubmissionAsEditor('dbarnes', null, 'Paglieri'); | ||
cy.get('#publication-button').click(); | ||
|
||
cy.get('button:contains("Delete version")').should('not.exist'); | ||
cy.get('.pkpHeader__actions button:contains("Post")').click(); | ||
cy.get('.pkp_modal_panel button:contains("Post")').click(); | ||
}); | ||
it('Author - Creates and submits new version', function () { | ||
cy.login('fpaglieri', null, 'publicknowledge'); | ||
cy.get('#archive-button').click(); | ||
cy.contains('View Paglieri').click({force: true}); | ||
|
||
cy.get('button:contains("Create New Version")').click(); | ||
cy.waitJQuery(); | ||
|
||
cy.get('button:contains("Submit New Version")').click(); | ||
cy.get('input[name="versionJustification"]').clear().type('Valid reason to submit a version', {delay: 0}); | ||
cy.get('#submitVersionModal button:contains("Submit")').click(); | ||
}); | ||
it("Moderator - Checks can delete only versions never posted", function () { | ||
cy.login('dbarnes', null, 'publicknowledge'); | ||
cy.get('#newVersion-button').click(); | ||
cy.contains('View Paglieri').click({force: true}); | ||
|
||
cy.get('#publication-button').click(); | ||
|
||
cy.get('button:contains("Delete version")'); | ||
cy.get('.pkpHeader__actions button:contains("Post")').click(); | ||
cy.get('.pkp_modal_panel button:contains("Post")').click(); | ||
cy.waitJQuery(); | ||
|
||
cy.get('button:contains("Delete version")').should('not.exist'); | ||
cy.get('button:contains("Unpost")').click(); | ||
cy.get('.modal button:contains("Unpost")').click(); | ||
cy.waitJQuery(); | ||
|
||
cy.get('button:contains("Delete version")').should('not.exist'); | ||
cy.get('.pkpHeader__actions button:contains("Post")').click(); | ||
cy.get('.pkp_modal_panel button:contains("Post")').click(); | ||
}); | ||
it('Author - Creates new version without submitting', function () { | ||
cy.login('fpaglieri', null, 'publicknowledge'); | ||
cy.get('#archive-button').click(); | ||
cy.contains('View Paglieri').click({force: true}); | ||
|
||
cy.get('button:contains("Create New Version")').click(); | ||
cy.waitJQuery(); | ||
}); | ||
it("Moderator - Deletes last version", function () { | ||
cy.login('dbarnes', null, 'publicknowledge'); | ||
cy.get('#newVersion-button').click(); | ||
cy.contains('View Paglieri').click({force: true}); | ||
|
||
cy.get('#publication-button').click(); | ||
cy.get('button:contains("Delete version")').click(); | ||
cy.get('.modal button:contains("Delete")').click(); | ||
cy.waitJQuery(); | ||
|
||
cy.get('.pkpPublication__version').contains('2'); | ||
cy.get('.pkpPublication__statusPublished').contains('Posted'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<pkp-button | ||
v-if="workingPublication.id === latestPublicationId && !workingPublication.datePublished && workingPublication.version > 1" | ||
ref="deleteVersionButton" | ||
:is-warnable="true" | ||
@click="$modal.show('deleteVersion')" | ||
> | ||
{translate key="plugins.generic.authorVersion.deleteVersion"} | ||
</pkp-button> | ||
<modal | ||
v-bind="MODAL_PROPS" | ||
name="deleteVersion" | ||
@closed="setFocusToRef('deleteVersionButton')" | ||
> | ||
<modal-content | ||
id="deleteVersionModal" | ||
modal-name="deleteVersion" | ||
title="{translate key="plugins.generic.authorVersion.deleteVersion"}" | ||
> | ||
<pkp-form v-bind="components.deleteVersionForm" @set="set" @success="location.reload()"></pkp-form> | ||
</modal-content> | ||
</modal> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters