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/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 = '' + } +})
- {{ $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", [