Change Edit submission button text (#105)

This commit is contained in:
Chirag Chhatrala 2023-03-15 22:41:38 +05:30 committed by GitHub
parent 825492bf45
commit 2b00137c76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 46 additions and 3 deletions

View File

@ -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',

View File

@ -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 = [

View File

@ -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',

View File

@ -84,6 +84,7 @@ class FormFactory extends Factory
'password' => false,
'tags' => [],
'slack_webhook_url' => null,
'editable_submissions_button_text' => 'Edit submission'
];
}

View File

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('forms', function (Blueprint $table) {
$table->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');
});
}
};

View File

@ -110,7 +110,9 @@
{{ form.re_fill_button_text }}
</open-form-button>
<p v-if="form.editable_submissions && submissionId" class="mt-5">
<a target="_parent" :href="form.share_url+'?submission_id='+submissionId" class="text-nt-blue hover:underline">Edit submission</a>
<a target="_parent" :href="form.share_url+'?submission_id='+submissionId" class="text-nt-blue hover:underline">
{{ form.editable_submissions_button_text }}
</a>
</p>
<p v-if="!form.no_branding" class="mt-5">
<a target="_parent" href="https://opnform.com/?utm_source=form&utm_content=create_form_free" class="text-nt-blue hover:underline">Create your form for free with OpnForm</a>

View File

@ -23,6 +23,11 @@
<toggle-switch-input name="editable_submissions" :form="form" class="mt-4"
label="Allow users to edit their submission"
/>
<text-input v-if="form.editable_submissions" name="editable_submissions_button_text"
:form="form"
label="Text of editable submissions button"
:required="true"
/>
<flat-select-input :form="submissionOptions" name="databaseAction" label="Database Submission Action"
:options="[

View File

@ -41,6 +41,7 @@ export default {
rating_max_value: 5,
max_submissions_count: null,
max_submissions_reached_text: 'This form has now reached the maximum number of allowed submissions and is now closed.',
editable_submissions_button_text: 'Edit submission',
// Security & Privacy
can_be_indexed: true

View File

@ -4,7 +4,7 @@
@if($form->editable_submissions)
@component('mail::button', ['url' => $form->share_url.'?submission_id='.$submission_id])
Edit submission
{{$form.editable_submissions_button_text}}
@endcomponent
@endif