Invert submitOnce on UI
Signed-off-by: Jonas Rittershofer <jotoeri@users.noreply.github.com>
This commit is contained in:
parent
8779ded0dc
commit
3ed4fef4fa
|
@ -174,6 +174,7 @@ class ApiController extends Controller {
|
||||||
$form->setAccess([
|
$form->setAccess([
|
||||||
'type' => 'public'
|
'type' => 'public'
|
||||||
]);
|
]);
|
||||||
|
$form->setSubmitOnce(true);
|
||||||
|
|
||||||
$this->formMapper->insert($form);
|
$this->formMapper->insert($form);
|
||||||
|
|
||||||
|
|
|
@ -48,13 +48,13 @@
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<input id="submitOnce"
|
<input id="submitOnce"
|
||||||
v-model="form.submitOnce"
|
v-model="submitMultiple"
|
||||||
:disabled="isPublic || form.isAnonymous"
|
:disabled="isPublic || form.isAnonymous"
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
@change="onSubmitOnceChange">
|
@change="onSubmitOnceChange">
|
||||||
<label for="submitOnce">
|
<label for="submitOnce">
|
||||||
{{ t('forms', 'Only allow one response per user') }}
|
{{ t('forms', 'Allow multiple responses per person') }}
|
||||||
</label>
|
</label>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
@ -177,6 +177,19 @@ export default {
|
||||||
return window.location.protocol + '//' + window.location.host + generateUrl(`/apps/forms/${this.form.hash}`)
|
return window.location.protocol + '//' + window.location.host + generateUrl(`/apps/forms/${this.form.hash}`)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Inverting submitOnce for UI here. Adapt downto Db for V3, if this imposes for longterm.
|
||||||
|
submitMultiple: {
|
||||||
|
get() {
|
||||||
|
if (this.form.access.type === 'public' || this.form.isAnonymous) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return !this.form.submitOnce
|
||||||
|
},
|
||||||
|
set(submitMultiple) {
|
||||||
|
this.form.submitOnce = !submitMultiple
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
formExpires: {
|
formExpires: {
|
||||||
get() {
|
get() {
|
||||||
return this.form.expires !== 0
|
return this.form.expires !== 0
|
||||||
|
|
Loading…
Reference in a new issue