diff --git a/src/pages/dashboard/SubmissionSummaryModal/SubmissionSummaryModal.vue b/src/pages/dashboard/SubmissionSummaryModal/SubmissionSummaryModal.vue
index 16f307700..07f4c1a3a 100644
--- a/src/pages/dashboard/SubmissionSummaryModal/SubmissionSummaryModal.vue
+++ b/src/pages/dashboard/SubmissionSummaryModal/SubmissionSummaryModal.vue
@@ -46,7 +46,7 @@
v-if="summaryStore.publicationControlsLeft?.length"
#publication-controls-left
>
-
+
{
+ return [
+ {
+ component: 'WorkflowChangeSubmissionLanguage',
+ props: {
+ submission,
+ canChangeSubmissionLanguage: false,
+ },
+ },
+ ];
+ },
getSecondaryItems: ({submission, selectedReviewRound, selectedStageId}) => {
const items = [];
return items;
diff --git a/src/pages/dashboard/SubmissionSummaryModal/composables/useWorkflowEditorialConfig.js b/src/pages/dashboard/SubmissionSummaryModal/composables/useWorkflowEditorialConfig.js
index 420a79f9b..3d6ac0475 100644
--- a/src/pages/dashboard/SubmissionSummaryModal/composables/useWorkflowEditorialConfig.js
+++ b/src/pages/dashboard/SubmissionSummaryModal/composables/useWorkflowEditorialConfig.js
@@ -58,6 +58,19 @@ function getHeaderItems({
}
export const WorkflowConfig = {
+ common: {
+ getPrimaryItems: ({submission, permissions}) => {
+ return [
+ {
+ component: 'WorkflowChangeSubmissionLanguage',
+ props: {
+ submission,
+ canChangeSubmissionLanguage: false,
+ },
+ },
+ ];
+ },
+ },
[pkp.const.WORKFLOW_STAGE_ID_SUBMISSION]: {
getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];
@@ -539,9 +552,24 @@ export const PublicationConfig = {
submission,
selectedPublicationId,
selectedPublication,
+ permissions,
}) => {
const items = [];
+ if (
+ submission.status !== pkp.const.STATUS_PUBLISHED &&
+ submission.publications.length < 2
+ ) {
+ items.push({
+ component: 'WorkflowChangeSubmissionLanguage',
+ props: {
+ submission,
+ canChangeSubmissionLanguage:
+ permissions.canChangeSubmissionLanguage,
+ },
+ });
+ }
+
items.push({
component: 'PublicationVersionControl',
props: {
diff --git a/src/pages/dashboard/SubmissionSummaryModal/publicationControls/WorkflowChangeSubmissionLanguage.vue b/src/pages/dashboard/SubmissionSummaryModal/publicationControls/WorkflowChangeSubmissionLanguage.vue
new file mode 100644
index 000000000..9013f0c54
--- /dev/null
+++ b/src/pages/dashboard/SubmissionSummaryModal/publicationControls/WorkflowChangeSubmissionLanguage.vue
@@ -0,0 +1,39 @@
+
+
+
+ {{ t('submission.list.changeSubmissionLanguage.currentLanguage') }}
+
+
{{ languageLabel }}
+
+ {{ t('submission.list.changeSubmissionLanguage.buttonLabel') }}
+
+
+
+
+
diff --git a/src/pages/dashboard/SubmissionSummaryModal/submissionSummaryStore.js b/src/pages/dashboard/SubmissionSummaryModal/submissionSummaryStore.js
index 1145c4e78..2768e1ae9 100644
--- a/src/pages/dashboard/SubmissionSummaryModal/submissionSummaryStore.js
+++ b/src/pages/dashboard/SubmissionSummaryModal/submissionSummaryStore.js
@@ -120,6 +120,8 @@ export const useSubmissionSummaryStore = defineComponentStore(
let canPublish = false;
// Access to activity log
let canAccessEditorialHistory = false;
+ // Changing submission language
+ let canChangeSubmissionLanguage = false;
let accessibleStages = [];
@@ -204,12 +206,17 @@ export const useSubmissionSummaryStore = defineComponentStore(
canAccessEditorialHistory = true;
}
+ if (canPublish || canEditPublication) {
+ canChangeSubmissionLanguage = true;
+ }
+
return {
canAccessPublication,
canAccessProduction,
canEditPublication,
canPublish,
canAccessEditorialHistory,
+ canChangeSubmissionLanguage,
accessibleStages,
};
});
diff --git a/src/pages/dashboard/composables/useWorkflowActions.js b/src/pages/dashboard/composables/useWorkflowActions.js
index 40e37df2a..b2388b36a 100644
--- a/src/pages/dashboard/composables/useWorkflowActions.js
+++ b/src/pages/dashboard/composables/useWorkflowActions.js
@@ -5,6 +5,7 @@ import {useUrl} from '@/composables/useUrl';
import {useForm} from '@/composables/useForm';
import {useFetch} from '@/composables/useFetch';
import {useLegacyGridUrl} from '@/composables/useLegacyGridUrl';
+import ChangeSubmissionLanguage from '@/pages/workflow/ChangeSubmissionLanguage.vue';
import SelectRevisionFormModal from '../components/SelectRevisionFormModal.vue';
@@ -24,6 +25,7 @@ export const Actions = {
WORKFLOW_UNSCHEDULE_PUBLICATION: 'workflowUnschedulePublication',
WORKFLOW_UNPUBLISH_PUBLICATION: 'workflowUnpublishPublication',
WORKFLOW_CREATE_NEW_VERSION: 'workflowCreateNewVersion',
+ WORKFLOW_CHANGE_SUBMISSION_LANGUAGE: 'workflowChangeSubmissionLanguage',
};
export function useWorkflowActions({
@@ -298,6 +300,14 @@ export function useWorkflowActions({
redirectToPage();
}
+ function workflowChangeSubmissionLanguage({submission}) {
+ const {openSideModal} = useModal();
+ openSideModal(ChangeSubmissionLanguage, {
+ publicationId: submission.currentPublicationId,
+ submissionId: submission.id,
+ });
+ }
+
return {
workflowViewPublishedSubmission,
workflowAssignToIssue,
@@ -311,5 +321,6 @@ export function useWorkflowActions({
workflowUnpublishPublication,
workflowCreateNewVersion,
workflowPreviewPublication,
+ workflowChangeSubmissionLanguage,
};
}
diff --git a/src/pages/workflow/ChangeSubmissionLanguage.vue b/src/pages/workflow/ChangeSubmissionLanguage.vue
index dfc8396b5..c0e8d93e7 100644
--- a/src/pages/workflow/ChangeSubmissionLanguage.vue
+++ b/src/pages/workflow/ChangeSubmissionLanguage.vue
@@ -13,6 +13,7 @@
{
+ // this form is not related only to submission, not publication
+ return `submissions/${props.submissionId}/publications/${props.publicationId}/_components/changeLanguageMetadata`;
+ });
+ const {apiUrl: publicationFormUrl} = useUrl(relativeUrl);
+ const {data: changeSubmissionForm, fetch: fetchForm} =
+ useFetch(publicationFormUrl);
+
+ watch(
+ publicationFormUrl,
+ (newRelativeUrl, prevRelativeUrl) => {
+ if (newRelativeUrl !== prevRelativeUrl) {
+ fetchForm();
+ }
+ },
+ {immediate: true},
+ );
+
+ const {form, getValue, set, setValue} = useForm(changeSubmissionForm);
// Set action api url
form.action = publicationApiUrl + '/changeLocale';
// Set initial value
- const publicationTitle = ref(getValue('title'));
+
+ const publicationTitle = ref('');
const publicationProps = {};
// Get publication props
@@ -61,12 +78,12 @@ export const useChangeSubmissionLanguageStore = defineComponentStore(
*/
const setCustom = (_, data) => {
set(_, data);
- const oldLocale = form.primaryLocale;
+ const oldLocale = form.value.primaryLocale;
const newLocale = getValue('locale');
// Set fields when changing language
if (newLocale !== oldLocale) {
- form.primaryLocale = newLocale;
- form.fields.forEach((field) => {
+ form.value.primaryLocale = newLocale;
+ form.value.fields.forEach((field) => {
if (publicationProps[field.name]) {
setValue(
field.name,
@@ -95,19 +112,23 @@ export const useChangeSubmissionLanguageStore = defineComponentStore(
*/
async function getData() {
- const {data, fetch} = useFetch(publicationApiUrl, {
- method: 'GET',
- });
- await fetch();
-
- Object.assign(publicationProps, data.value ?? {});
+ const {data: publication, fetch: fetchPublication} = useFetch(
+ publicationApiUrl,
+ {
+ method: 'GET',
+ },
+ );
+ await fetchPublication();
+
+ Object.assign(publicationProps, publication.value ?? {});
delete publicationProps['locale'];
- publicationTitle.value = data.value.title[props.form.primaryLocale];
+ publicationTitle.value =
+ publication.value.fullTitle[publication.value.locale];
}
function getLocaleName(locale) {
- return form.fields
+ return form.value.fields
.find(({name}) => name === 'locale')
.options.find(({value}) => value === locale).label;
}