Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update internal mrf form language and align button behaviour #829

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Controllers/ManuscriptRecordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]);

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/ManuscriptRecordResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/Models/ManuscriptRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
vincentauger marked this conversation as resolved.
Show resolved Hide resolved
$table->text('no_ogl_explanation')->nullable();
$table->renameColumn('additional_information', 'public_interest_information');
});
Expand Down
6 changes: 6 additions & 0 deletions resources/src/components/QuestionEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ function onPaste(e: ClipboardEvent) {
})
editor.value?.runCmd('insertHTML', cleanText)
}

watch(value, (newValue) => {
if (newValue === '<br>') {
value.value = ''
}
})
</script>

<template>
Expand Down
6 changes: 3 additions & 3 deletions resources/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 \"{url}\" 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",
Expand Down
6 changes: 3 additions & 3 deletions resources/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 sengage 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",
"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",
Expand Down
2 changes: 1 addition & 1 deletion resources/src/models/ManuscriptRecord/ManuscriptRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down Expand Up @@ -536,6 +536,7 @@ async function generatePLS() {
.potential_public_interest
"
class="q-mb-md"
:disable="isManuscriptReadOnly"
/>
<p>
{{
Expand All @@ -551,7 +552,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"
>
Expand All @@ -569,16 +570,17 @@ async function generatePLS() {
</template>
</i18n-t>
<div class="text-body2 text-primary text-weight-medium">
{{ $t('mrf.do_not_apply_ogl') }}
{{ $t('mrf.apply_ogl') }}
</div>
<YesNoBooleanOptionGroup
v-model="
manuscriptResource.data
.do_not_apply_ogl
.apply_ogl
"
class="q-mb-md"
:disable="isManuscriptReadOnly"
/>
<p v-if="manuscriptResource.data.do_not_apply_ogl">
<p v-if="!manuscriptResource.data.apply_ogl">
{{ $t('mrf.ogl-provide-explanation') }}
</p>
</QuestionEditor>
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/Models/ManuscriptRecordTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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", [
Expand Down
Loading