From 1eca69217612543f72b884ef413999880dc0dd6e Mon Sep 17 00:00:00 2001 From: MathewE Date: Tue, 19 Nov 2024 16:13:00 -0330 Subject: [PATCH 1/4] fix(ogl): update mrf form language and align button behaviour --- app/Http/Controllers/ManuscriptRecordController.php | 2 +- app/Http/Resources/ManuscriptRecordResource.php | 2 +- app/Models/ManuscriptRecord.php | 4 ++-- ...59_add_ogl_question_to_manuscript_records_table.php | 2 +- resources/src/locales/en.json | 6 +++--- resources/src/locales/fr.json | 6 +++--- .../src/models/ManuscriptRecord/ManuscriptRecord.ts | 2 +- .../views/ManuscriptRecordFormView.vue | 10 +++++----- tests/Feature/Models/ManuscriptRecordTest.php | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/ManuscriptRecordController.php b/app/Http/Controllers/ManuscriptRecordController.php index 7e04659f..370fd17b 100644 --- a/app/Http/Controllers/ManuscriptRecordController.php +++ b/app/Http/Controllers/ManuscriptRecordController.php @@ -75,7 +75,7 @@ public function update(Request $request, ManuscriptRecord $manuscriptRecord): Js 'relevant_to' => 'nullable|string', 'public_interest_information' => 'nullable|string', 'potential_public_interest' => 'boolean', - 'do_not_apply_ogl' => 'boolean', + 'apply_ogl' => 'boolean', 'no_ogl_explanation' => 'nullable|string', ]); diff --git a/app/Http/Resources/ManuscriptRecordResource.php b/app/Http/Resources/ManuscriptRecordResource.php index 14bc29d6..390089ef 100644 --- a/app/Http/Resources/ManuscriptRecordResource.php +++ b/app/Http/Resources/ManuscriptRecordResource.php @@ -33,7 +33,7 @@ public function toArray($request) 'relevant_to' => $this->relevant_to ?? '', 'potential_public_interest' => $this->potential_public_interest, 'public_interest_information' => $this->public_interest_information ?? '', - 'do_not_apply_ogl' => $this->do_not_apply_ogl, + 'apply_ogl' => $this->apply_ogl, 'no_ogl_explanation' => $this->no_ogl_explanation ?? '', // dates and times diff --git a/app/Models/ManuscriptRecord.php b/app/Models/ManuscriptRecord.php index 7ee3830a..41602dad 100644 --- a/app/Models/ManuscriptRecord.php +++ b/app/Models/ManuscriptRecord.php @@ -51,7 +51,7 @@ class ManuscriptRecord extends Model implements Fundable, HasMedia 'type' => ManuscriptRecordType::class, 'status' => ManuscriptRecordStatus::class, 'potential_public_interest' => 'boolean', - 'do_not_apply_ogl' => 'boolean', + 'apply_ogl' => 'boolean', ]; // default values for optional fields @@ -244,7 +244,7 @@ public function validateIsFilled(bool $noExceptions = false): bool 'region_id' => 'required|exists:regions,id', 'functional_area_id' => 'required|exists:functional_areas,id', 'relevant_to' => 'required', - 'no_ogl_explanation' => 'required_if:do_not_apply_ogl,true', + 'no_ogl_explanation' => 'required_if:apply_ogl,false', ]); $validator->after(function ($validator) { diff --git a/database/migrations/2024_11_14_184759_add_ogl_question_to_manuscript_records_table.php b/database/migrations/2024_11_14_184759_add_ogl_question_to_manuscript_records_table.php index dbdfa3cf..70266171 100644 --- a/database/migrations/2024_11_14_184759_add_ogl_question_to_manuscript_records_table.php +++ b/database/migrations/2024_11_14_184759_add_ogl_question_to_manuscript_records_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::table('manuscript_records', function (Blueprint $table) { - $table->boolean('do_not_apply_ogl')->default(false); + $table->boolean('apply_ogl')->default(true); $table->text('no_ogl_explanation')->nullable(); $table->renameColumn('additional_information', 'public_interest_information'); }); diff --git a/resources/src/locales/en.json b/resources/src/locales/en.json index 2975d388..801bc429 100644 --- a/resources/src/locales/en.json +++ b/resources/src/locales/en.json @@ -522,10 +522,10 @@ "working-title-text": "Enter to the manuscript's working title. You will be able to modify the title when you update this manuscript status to published.", "functional-area-text": "In order to improve reporting on research outputs, please select the relevant functional area for this manuscript.", "no-ogl-explanation": "Report Licensing", - "no-ogl-explanation-text-field-text": "DFO is committed to the \"Open by Design and by Default\" principle of Open Science, which means that all DFO publications will be published under the latest version of the \"{url}\" Are there any specific reasons or concerns that would prevent your report from being licensed under this Open Government Licence?", + "no-ogl-explanation-text-field-text": "DFO is committed to the \"Open by Design and by Default\" principle of Open Science, ensuring that all DFO publications are made available under the latest version of the \"Open Government Licence - Canada\" whenever possible. The Open Government Licence - Canada should not be applied if there are conflicting Licensing obligations.", "ogl-link": "Open Government Licence - Canada", - "do_not_apply_ogl": "We have reasons not to apply an open license for this report.", - "ogl-provide-explanation": "Since you answered \"yes,\" please provide an explanation of why an open license cannot be applied to your report." + "apply_ogl": "Should this report be licensed under the Open Government Licence - Canada?", + "ogl-provide-explanation": "Since you answered \"No,\" please provide an explanation of why an Open Government License cannot be applied to your report." }, "my-manuscript-records": { "actions-still-required": "Actions still required", diff --git a/resources/src/locales/fr.json b/resources/src/locales/fr.json index 9e8cc1ae..c1479a56 100644 --- a/resources/src/locales/fr.json +++ b/resources/src/locales/fr.json @@ -521,11 +521,11 @@ "upload-text": "Téléchargez la copie la plus récente de votre manuscrit au format PDF. \nCe fichier peut être mis à jour selon les besoins du demandeur, même après la soumission du manuscrit.", "working-title-text": "Entrez le titre provisoir du manuscrit. \nVous pourrez modifier le titre lorsque vous mettrez à jour le statut de ce manuscrit à publié.", "functional-area-text": "Afin d'améliorer les rapports sur les résultats de la recherche, veuillez sélectionner le domaine fonctionnel pertinent pour ce manuscrit.", - "no-ogl-explanation-text-field-text": "Le MPO s'engage à suivre le principe « ouvert par conception et par défaut » de la science ouverte. Par conséquent, toutes les publications du MPO seront publiées sous la dernière version de la « {url} ». Avez-vous des raisons de croire que votre rapport ne devrait pas être licencié sous cette licence du gouvernement ouvert?", + "no-ogl-explanation-text-field-text": "MPO s’engage envers le principe de « Ouvert par conception et par défaut » de la science ouverte, en s’assurant que toutes les publications du MPO soient mises à disposition sous la dernière version de la « Licence du gouvernement ouvert - Canada » dans la mesure du possible. La Licence du gouvernement ouvert - Canada ne doit pas être appliquée s’il existe des obligations de licence conflictuelles.", "ogl-link": "Licence du gouvernement ouvert – Canada", - "do_not_apply_ogl": "Nous avons des raisons de ne pas appliquer une licence ouverte pour ce rapport.", + "apply_ogl": "Ce rapport devrait-il être licencié sous la Licence du gouvernement ouvert - Canada ?", "no-ogl-explanation": "Licence de rapport", - "ogl-provide-explanation": "Puisque vous avez répondu « oui », veuillez expliquer pourquoi une licence ouverte ne peut pas être appliquée à votre rapport." + "ogl-provide-explanation": "Puisque vous avez répondu « Non », veuillez fournir une explication des raisons pour lesquelles une Licence du gouvernement ouvert ne peut pas être appliquée à votre rapport." }, "my-manuscript-records": { "actions-still-required": "Actions encore nécessaires", diff --git a/resources/src/models/ManuscriptRecord/ManuscriptRecord.ts b/resources/src/models/ManuscriptRecord/ManuscriptRecord.ts index 55b83a01..dac55e78 100644 --- a/resources/src/models/ManuscriptRecord/ManuscriptRecord.ts +++ b/resources/src/models/ManuscriptRecord/ManuscriptRecord.ts @@ -48,7 +48,7 @@ export interface ManuscriptRecord extends BaseManuscriptRecord { relevant_to: string potential_public_interest: boolean public_interest_information: string - do_not_apply_ogl: boolean + apply_ogl: boolean no_ogl_explanation: string readonly sent_for_review_at: string | null readonly reviewed_at: string | null diff --git a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue index 2b3c9013..a24c1a02 100644 --- a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue +++ b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue @@ -83,7 +83,7 @@ const generalSectionStatus = computed(() => { return 'error' if (manuscript.type === 'secondary') { - if (manuscript.no_ogl_explanation === '' && manuscript.do_not_apply_ogl) + if (manuscript.no_ogl_explanation === '' && manuscript.apply_ogl) return 'incomplete' } @@ -551,7 +551,7 @@ async function generatePLS() { :title="$t('mrf.no-ogl-explanation')" :disable="loading" :readonly="isManuscriptReadOnly" - :hide-editor="!manuscriptResource.data.do_not_apply_ogl" + :hide-editor="manuscriptResource.data.apply_ogl" required class="q-mb-md" > @@ -569,16 +569,16 @@ async function generatePLS() {
- {{ $t('mrf.do_not_apply_ogl') }} + {{ $t('mrf.apply_ogl') }}
-

+

{{ $t('mrf.ogl-provide-explanation') }}

diff --git a/tests/Feature/Models/ManuscriptRecordTest.php b/tests/Feature/Models/ManuscriptRecordTest.php index 7df9a08d..a23d7b8b 100644 --- a/tests/Feature/Models/ManuscriptRecordTest.php +++ b/tests/Feature/Models/ManuscriptRecordTest.php @@ -272,7 +272,7 @@ test('a user cannot submit their manuscript for review if they do not want an OGL but have provide no explanation', function () { $manuscript = ManuscriptRecord::factory()->filled()->create([ - 'do_not_apply_ogl' => true, + 'apply_ogl' => false, ]); $this->actingAs($manuscript->user)->putJson("/api/manuscript-records/{$manuscript->id}/submit-for-review", [ From 6782771ef8aed376ab4f5a7fe9891af31d06c12a Mon Sep 17 00:00:00 2001 From: Mathew E <105732593+MathewEm@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:46:34 -0330 Subject: [PATCH 2/4] Apply suggestions from code review Looks Good Co-authored-by: Vincent Auger Signed-off-by: Mathew E <105732593+MathewEm@users.noreply.github.com> --- resources/src/locales/en.json | 2 +- resources/src/locales/fr.json | 2 +- .../models/ManuscriptRecord/views/ManuscriptRecordFormView.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/src/locales/en.json b/resources/src/locales/en.json index 801bc429..758c995c 100644 --- a/resources/src/locales/en.json +++ b/resources/src/locales/en.json @@ -522,7 +522,7 @@ "working-title-text": "Enter to the manuscript's working title. You will be able to modify the title when you update this manuscript status to published.", "functional-area-text": "In order to improve reporting on research outputs, please select the relevant functional area for this manuscript.", "no-ogl-explanation": "Report Licensing", - "no-ogl-explanation-text-field-text": "DFO is committed to the \"Open by Design and by Default\" principle of Open Science, ensuring that all DFO publications are made available under the latest version of the \"Open Government Licence - Canada\" whenever possible. The Open Government Licence - Canada should not be applied if there are conflicting Licensing obligations.", + "no-ogl-explanation-text-field-text": "DFO is committed to the \"Open by Design and by Default\" principle of Open Science, ensuring that all DFO publications are made available under the latest version of the \"{url}\" whenever possible. The Open Government Licence - Canada should not be applied if there are conflicting Licensing obligations.", "ogl-link": "Open Government Licence - Canada", "apply_ogl": "Should this report be licensed under the Open Government Licence - Canada?", "ogl-provide-explanation": "Since you answered \"No,\" please provide an explanation of why an Open Government License cannot be applied to your report." diff --git a/resources/src/locales/fr.json b/resources/src/locales/fr.json index c1479a56..e923b64c 100644 --- a/resources/src/locales/fr.json +++ b/resources/src/locales/fr.json @@ -521,7 +521,7 @@ "upload-text": "Téléchargez la copie la plus récente de votre manuscrit au format PDF. \nCe fichier peut être mis à jour selon les besoins du demandeur, même après la soumission du manuscrit.", "working-title-text": "Entrez le titre provisoir du manuscrit. \nVous pourrez modifier le titre lorsque vous mettrez à jour le statut de ce manuscrit à publié.", "functional-area-text": "Afin d'améliorer les rapports sur les résultats de la recherche, veuillez sélectionner le domaine fonctionnel pertinent pour ce manuscrit.", - "no-ogl-explanation-text-field-text": "MPO s’engage envers le principe de « Ouvert par conception et par défaut » de la science ouverte, en s’assurant que toutes les publications du MPO soient mises à disposition sous la dernière version de la « Licence du gouvernement ouvert - Canada » dans la mesure du possible. La Licence du gouvernement ouvert - Canada ne doit pas être appliquée s’il existe des obligations de licence conflictuelles.", + "no-ogl-explanation-text-field-text": "MPO s’engage envers le principe de « Ouvert par conception et par défaut » de la science ouverte, en s’assurant que toutes les publications du MPO soient mises à disposition sous la dernière version de la « {url} » dans la mesure du possible. La Licence du gouvernement ouvert - Canada ne doit pas être appliquée s’il existe des obligations de licence conflictuelles.", "ogl-link": "Licence du gouvernement ouvert – Canada", "apply_ogl": "Ce rapport devrait-il être licencié sous la Licence du gouvernement ouvert - Canada ?", "no-ogl-explanation": "Licence de rapport", diff --git a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue index a24c1a02..fb7f8c4b 100644 --- a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue +++ b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue @@ -83,7 +83,7 @@ const generalSectionStatus = computed(() => { return 'error' if (manuscript.type === 'secondary') { - if (manuscript.no_ogl_explanation === '' && manuscript.apply_ogl) + if (manuscript.no_ogl_explanation === '' && !manuscript.apply_ogl) return 'incomplete' } From 78f11513a8b20284eed0ab5bb1b2f7ce7c533b59 Mon Sep 17 00:00:00 2001 From: Vincent Auger Date: Wed, 20 Nov 2024 11:14:34 -0400 Subject: [PATCH 3/4] fix: disable fields when manuscript is read-only --- .../models/ManuscriptRecord/views/ManuscriptRecordFormView.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue index fb7f8c4b..73d5483d 100644 --- a/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue +++ b/resources/src/models/ManuscriptRecord/views/ManuscriptRecordFormView.vue @@ -536,6 +536,7 @@ async function generatePLS() { .potential_public_interest " class="q-mb-md" + :disable="isManuscriptReadOnly" />

{{ @@ -577,6 +578,7 @@ async function generatePLS() { .apply_ogl " class="q-mb-md" + :disable="isManuscriptReadOnly" />

{{ $t('mrf.ogl-provide-explanation') }} From d977fed29d9c68dbb9fdf7485ce318dc59e36199 Mon Sep 17 00:00:00 2001 From: Vincent Auger Date: Wed, 20 Nov 2024 11:43:00 -0400 Subject: [PATCH 4/4] fix: clear value when only a line break is in QuestionEditor --- resources/src/components/QuestionEditor.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/src/components/QuestionEditor.vue b/resources/src/components/QuestionEditor.vue index e517a86e..b4bf7de9 100644 --- a/resources/src/components/QuestionEditor.vue +++ b/resources/src/components/QuestionEditor.vue @@ -55,6 +55,12 @@ function onPaste(e: ClipboardEvent) { }) editor.value?.runCmd('insertHTML', cleanText) } + +watch(value, (newValue) => { + if (newValue === '
') { + value.value = '' + } +})