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 = []; $validator = [];
if ($includeFormName) { if ($includeFormName) {
$validator['formName'] = 'required|string|max:100'; $validator['formName'] = 'required|string';
} }
foreach ($fields as $fieldName => $field) { foreach ($fields as $fieldName => $field) {

View File

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

View File

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

View File

@ -69,6 +69,8 @@
<p>{{__('messages.application_r.welcome.line2', ['agerqr' => '18 ' . __('messages.application_r.welcome.yrs_old')])}}.</p> <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 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>
</div> </div>

View File

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