Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Miguel Nogueira 2021-03-31 15:50:55 +01:00
commit 6940b1816e
Signed by: miguel456
GPG Key ID: 2CF61B825316C6A0
8 changed files with 20 additions and 3 deletions

View File

@ -71,7 +71,7 @@ class ContextAwareValidator
$validator = [];
if ($includeFormName) {
$validator['formName'] = 'required|string|max:100';
$validator['formName'] = 'required|string';
}
foreach ($fields as $fieldName => $field) {

View File

@ -36,6 +36,8 @@ use Illuminate\Support\Facades\Log;
class ApplicationController extends Controller
{
private function canVote($votes): bool
{
$allvotes = collect([]);

View File

@ -82,6 +82,7 @@ class FormController extends Controller
public function destroy(Request $request, Form $form)
{
$this->authorize('delete', $form);
$deletable = true;
if (! is_null($form) && ! is_null($form->vacancies) && $form->vacancies->count() !== 0 || ! is_null($form->responses)) {
@ -97,6 +98,7 @@ class FormController extends Controller
}
return redirect()->back();
}
public function preview(Request $request, Form $form)

4
public/js/unsaved.js vendored Normal file
View File

@ -0,0 +1,4 @@
// Load this on all pages requiring exit confirmation.
$(window).bind('beforeunload', function(){
return "Are you sure you want to exit this page? You might have unsaved work.";
});

View File

@ -10,6 +10,12 @@
@section('js')
<script>
jQuery(window).bind('beforeunload', function(){
return 'Are you sure you want to leave the form builder? You might have unsaved work.';
});
</script>
@if (session()->has('success'))
<script>

View File

@ -69,6 +69,8 @@
<p>{{__('messages.application_r.welcome.line2', ['agerqr' => '18 ' . __('messages.application_r.welcome.yrs_old')])}}.</p>
<p class="text-bold">{{__('messages.application_r.welcome.line3')}}.</p>
<p><i class="fab fa-markdown"></i> All fields support <a target="_blank" href="https://www.markdownguide.org/cheat-sheet/">Markdown</a></p>
</div>
</div>

View File

@ -103,7 +103,8 @@
<div class="mt-4 mb-3">
<h5>{{$content['title']}}</h5>
<p>{{$content['response']}}</p>
<p>{!! GrahamCampbell\Markdown\Facades\Markdown::convertToHtml($content['response']) !!}</p>
</div>

View File

@ -271,7 +271,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['lo
Route::delete('forms/destroy/{form}', [FormController::class, 'destroy'])
->name('destroyForm');
Route::get('forms', [FormController::class, 'index'])
->name('showForms');