diff --git a/app/Helpers/ContextAwareValidator.php b/app/Helpers/ContextAwareValidator.php index 6f59cb5..6257255 100755 --- a/app/Helpers/ContextAwareValidator.php +++ b/app/Helpers/ContextAwareValidator.php @@ -71,7 +71,7 @@ class ContextAwareValidator $validator = []; if ($includeFormName) { - $validator['formName'] = 'required|string|max:100'; + $validator['formName'] = 'required|string'; } foreach ($fields as $fieldName => $field) { diff --git a/app/Http/Controllers/ApplicationController.php b/app/Http/Controllers/ApplicationController.php index e3b5f4d..98d76e3 100755 --- a/app/Http/Controllers/ApplicationController.php +++ b/app/Http/Controllers/ApplicationController.php @@ -36,6 +36,8 @@ use Illuminate\Support\Facades\Log; class ApplicationController extends Controller { + + private function canVote($votes): bool { $allvotes = collect([]); diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php index 7c8407a..98d82a0 100755 --- a/app/Http/Controllers/FormController.php +++ b/app/Http/Controllers/FormController.php @@ -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) diff --git a/public/js/unsaved.js b/public/js/unsaved.js new file mode 100644 index 0000000..7406b14 --- /dev/null +++ b/public/js/unsaved.js @@ -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."; +}); \ No newline at end of file diff --git a/resources/views/dashboard/administration/formbuilder.blade.php b/resources/views/dashboard/administration/formbuilder.blade.php index 6a1129a..e808c1a 100755 --- a/resources/views/dashboard/administration/formbuilder.blade.php +++ b/resources/views/dashboard/administration/formbuilder.blade.php @@ -10,6 +10,12 @@ @section('js') + + @if (session()->has('success'))