From 2b00137c76bdd1c2aaf2de14d3a4d266a34f84f6 Mon Sep 17 00:00:00 2001 From: Chirag Chhatrala <60499540+chiragchhatrala@users.noreply.github.com> Date: Wed, 15 Mar 2023 22:41:38 +0530 Subject: [PATCH] Change Edit submission button text (#105) --- app/Http/Requests/UserFormRequest.php | 1 + app/Listeners/Forms/NotifyFormSubmission.php | 2 +- app/Models/Forms/Form.php | 1 + database/factories/FormFactory.php | 1 + ...table_submissions_button_text_to_forms.php | 32 +++++++++++++++++++ .../open/forms/OpenCompleteForm.vue | 4 ++- .../form-components/FormAboutSubmission.vue | 5 +++ resources/js/mixins/form_editor/initForm.js | 1 + ...irmation-submission-notification.blade.php | 2 +- 9 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 database/migrations/2023_03_13_094806_add_editable_submissions_button_text_to_forms.php diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index 5ec5a4a..033bc4b 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -71,6 +71,7 @@ abstract class UserFormRequest extends \Illuminate\Foundation\Http\FormRequest 'max_submissions_count' => 'integer|nullable|min:1', 'max_submissions_reached_text' => 'string|nullable', 'editable_submissions' => 'boolean|nullable', + 'editable_submissions_button_text' => 'string|min:1|max:50', // Properties 'properties' => 'required|array', diff --git a/app/Listeners/Forms/NotifyFormSubmission.php b/app/Listeners/Forms/NotifyFormSubmission.php index 865ddcd..b8e59d7 100644 --- a/app/Listeners/Forms/NotifyFormSubmission.php +++ b/app/Listeners/Forms/NotifyFormSubmission.php @@ -74,7 +74,7 @@ class NotifyFormSubmission implements ShouldQueue '*<'.$editFormURL.'|✍️ Edit Form>*' ]; if($event->form->editable_submissions){ - $externalLinks[] = '*<'.$event->form->share_url.'?submission_id='.$submissionId.'|✍️ Edit Submission>*'; + $externalLinks[] = '*<'.$event->form->share_url.'?submission_id='.$submissionId.'|✍️ '.$event->form->editable_submissions_button_text.'>*'; } $finalSlackPostData = [ diff --git a/app/Models/Forms/Form.php b/app/Models/Forms/Form.php index 725a2b5..fe50e63 100644 --- a/app/Models/Forms/Form.php +++ b/app/Models/Forms/Form.php @@ -77,6 +77,7 @@ class Form extends Model 'max_submissions_count', 'max_submissions_reached_text', 'editable_submissions', + 'editable_submissions_button_text', // Security & Privacy 'can_be_indexed', diff --git a/database/factories/FormFactory.php b/database/factories/FormFactory.php index 33c1acb..79086db 100644 --- a/database/factories/FormFactory.php +++ b/database/factories/FormFactory.php @@ -84,6 +84,7 @@ class FormFactory extends Factory 'password' => false, 'tags' => [], 'slack_webhook_url' => null, + 'editable_submissions_button_text' => 'Edit submission' ]; } diff --git a/database/migrations/2023_03_13_094806_add_editable_submissions_button_text_to_forms.php b/database/migrations/2023_03_13_094806_add_editable_submissions_button_text_to_forms.php new file mode 100644 index 0000000..e77e68b --- /dev/null +++ b/database/migrations/2023_03_13_094806_add_editable_submissions_button_text_to_forms.php @@ -0,0 +1,32 @@ +text('editable_submissions_button_text')->default('Edit submission'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('forms', function (Blueprint $table) { + $table->dropColumn('editable_submissions_button_text'); + }); + } +}; diff --git a/resources/js/components/open/forms/OpenCompleteForm.vue b/resources/js/components/open/forms/OpenCompleteForm.vue index 06531f2..bd9fc33 100644 --- a/resources/js/components/open/forms/OpenCompleteForm.vue +++ b/resources/js/components/open/forms/OpenCompleteForm.vue @@ -110,7 +110,9 @@ {{ form.re_fill_button_text }}

- Edit submission + + {{ form.editable_submissions_button_text }} +

Create your form for free with OpnForm diff --git a/resources/js/components/open/forms/components/form-components/FormAboutSubmission.vue b/resources/js/components/open/forms/components/form-components/FormAboutSubmission.vue index 0ad6734..76c09ab 100644 --- a/resources/js/components/open/forms/components/form-components/FormAboutSubmission.vue +++ b/resources/js/components/open/forms/components/form-components/FormAboutSubmission.vue @@ -23,6 +23,11 @@ +