From 1e1896660972f391174e7d43cf4dd9bca00ef4e8 Mon Sep 17 00:00:00 2001 From: Vincent Auger Date: Thu, 28 Nov 2024 09:24:30 -0400 Subject: [PATCH] feat: completes add supplementary files --- app/Http/Controllers/PublicationController.php | 8 ++++++++ resources/src/locales/en.json | 5 +++-- resources/src/locales/fr.json | 5 +++-- .../models/Media/components/MediaListItem.vue | 4 ++-- .../components/PublicationFileManagementCard.vue | 15 +++++++++++++-- ...ublicationSupplementaryFileManagementCard.vue | 2 +- .../Publication/views/PublicationsView.vue | 16 ++++++++-------- 7 files changed, 38 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/PublicationController.php b/app/Http/Controllers/PublicationController.php index 5eabdc97..d616e75e 100644 --- a/app/Http/Controllers/PublicationController.php +++ b/app/Http/Controllers/PublicationController.php @@ -56,6 +56,10 @@ public function store(Request $request): JsonResource 'is_open_access' => 'boolean', ]); + if($validated['is_open_access']){ + $validated['embargoed_until'] = null; + } + // create the publication $publication = new Publication($validated); $publication->user_id = $request->user()->id; @@ -110,6 +114,10 @@ public function update(Request $request, Publication $publication): JsonResource 'is_open_access' => 'boolean', ]); + if($validated['is_open_access']){ + $validated['embargoed_until'] = null; + } + // update the publication $publication->update($validated); diff --git a/resources/src/locales/en.json b/resources/src/locales/en.json index eda9b172..7df7eb6d 100644 --- a/resources/src/locales/en.json +++ b/resources/src/locales/en.json @@ -273,7 +273,8 @@ "document-type": "Document Type", "select-file": "Select or drop file here", "optional": "Optional", - "cant-download": "You are not authorized to download this file." + "cant-download": "You are not authorized to download this file.", + "publication-previous-version": "This is a previous version of the publication" }, "create-author-dialog": { "title": "Create a new author" @@ -636,7 +637,7 @@ }, "publication-page": { "attach-pub-details": "Please upload the most recent version of your publication in PDF format. Files in this section are subject to the applicable embargo period and can only be accessed by authorized users, such as the authors and managers, until the embargo has expired.", - "attach-publication": "Attach Publication", + "attach-publication": "Published Work", "go-to-manuscript-record": "Go to Manuscript Record", "mark-as-published": "Mark as Published", "publication-date-pending": "Publication Date Pending", diff --git a/resources/src/locales/fr.json b/resources/src/locales/fr.json index f15e6699..58ed5a14 100644 --- a/resources/src/locales/fr.json +++ b/resources/src/locales/fr.json @@ -273,7 +273,8 @@ "document-type": "Type de document", "optional": "Facultatif", "select-file": "Sélectionnez ou déposez le fichier ici", - "cant-download": "Vous n'êtes pas autorisé à télécharger ce fichier." + "cant-download": "Vous n'êtes pas autorisé à télécharger ce fichier.", + "publication-previous-version": "Ceci est une version précédente de la publication" }, "create-author-dialog": { "title": "Créer un nouvel auteur" @@ -636,7 +637,7 @@ }, "publication-page": { "attach-pub-details": "Veuillez télécharger la version la plus récente de votre publication au format PDF. \nLes fichiers de cette section sont soumis à la période d'embargo applicable et ne sont accessibles qu'aux utilisateurs autorisés, tels que les auteurs et les gestionnaires, jusqu'à l'expiration de l'embargo.", - "attach-publication": "Joindre la publication", + "attach-publication": "Travail publié", "go-to-manuscript-record": "Aller au registre du manuscrit", "mark-as-published": "Marquer comme publié", "publication-date-pending": "Date de publication en attente", diff --git a/resources/src/models/Media/components/MediaListItem.vue b/resources/src/models/Media/components/MediaListItem.vue index 1993244d..082f29a9 100644 --- a/resources/src/models/Media/components/MediaListItem.vue +++ b/resources/src/models/Media/components/MediaListItem.vue @@ -58,10 +58,10 @@ const { t } = useI18n() - + {{ t('common.cant-download') }} diff --git a/resources/src/models/Publication/components/PublicationFileManagementCard.vue b/resources/src/models/Publication/components/PublicationFileManagementCard.vue index 269fd733..3c1b5bae 100644 --- a/resources/src/models/Publication/components/PublicationFileManagementCard.vue +++ b/resources/src/models/Publication/components/PublicationFileManagementCard.vue @@ -39,7 +39,7 @@ async function upload() { props.publication.data.id, ) - publicationResourceList.value?.data.push(response) + publicationResourceList.value?.data.unshift(response) uploadingFile.value = false // clear file @@ -93,12 +93,23 @@ watch(publicationFile, () => { +