Merge pull request #452 from nextcloud/fix/submitOnce
Invert submitOnce on UI
This commit is contained in:
commit
fcf2874670
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -23,22 +23,64 @@
|
||||||
<template>
|
<template>
|
||||||
<AppSidebar
|
<AppSidebar
|
||||||
v-show="opened"
|
v-show="opened"
|
||||||
:title="form.title"
|
:title="t('forms', 'Share form')"
|
||||||
@close="onClose">
|
@close="onClose">
|
||||||
<template #secondary-actions>
|
<button class="copyShareLink" @click="copyShareLink">
|
||||||
<ActionLink icon="icon-clippy"
|
<span class="icon-clippy" role="img" />
|
||||||
:href="shareLink"
|
{{ t('forms', 'Copy share link') }}
|
||||||
@click.stop.prevent="copyShareLink">
|
</button>
|
||||||
{{ t('forms', 'Copy share link') }}
|
|
||||||
</ActionLink>
|
<ul>
|
||||||
</template>
|
<li>
|
||||||
|
<input id="public"
|
||||||
|
v-model="form.access.type"
|
||||||
|
type="radio"
|
||||||
|
value="public"
|
||||||
|
class="radio"
|
||||||
|
@change="onAccessChange">
|
||||||
|
<label for="public">
|
||||||
|
<span class="icon-public">
|
||||||
|
{{ t('forms', 'Share via link') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input id="registered"
|
||||||
|
v-model="form.access.type"
|
||||||
|
type="radio"
|
||||||
|
value="registered"
|
||||||
|
class="radio"
|
||||||
|
@change="onAccessChange">
|
||||||
|
<label for="registered">
|
||||||
|
<span class="icon-group">
|
||||||
|
{{ t('forms', 'Show to all users of this instance') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<input id="selected"
|
||||||
|
v-model="form.access.type"
|
||||||
|
type="radio"
|
||||||
|
value="selected"
|
||||||
|
class="radio"
|
||||||
|
@change="onAccessChange">
|
||||||
|
<label for="selected">
|
||||||
|
<span class="icon-shared">
|
||||||
|
{{ t('forms', 'Choose users to share with') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<ShareDiv v-show="form.access.type === 'selected'"
|
||||||
|
:user-shares="userShares"
|
||||||
|
:group-shares="groupShares"
|
||||||
|
@update:shares="onSharingChange" />
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<h3>{{ t('forms', 'Settings') }}</h3>
|
<h3>{{ t('forms', 'Settings') }}</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<input id="isAnonymous"
|
<input id="isAnonymous"
|
||||||
v-model="form.isAnonymous"
|
v-model="form.isAnonymous"
|
||||||
|
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
@change="onAnonChange">
|
@change="onAnonChange">
|
||||||
|
@ -48,13 +90,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>
|
||||||
|
@ -80,53 +122,6 @@
|
||||||
@change="onExpiresChange" />
|
@change="onExpiresChange" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>{{ t('forms', 'Sharing') }}</h3>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<input id="registered"
|
|
||||||
v-model="form.access.type"
|
|
||||||
type="radio"
|
|
||||||
value="registered"
|
|
||||||
class="radio"
|
|
||||||
@change="onAccessChange">
|
|
||||||
<label for="registered">
|
|
||||||
<span class="icon-group">
|
|
||||||
{{ t('forms', 'Show to all users of this instance') }}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<input id="public"
|
|
||||||
v-model="form.access.type"
|
|
||||||
type="radio"
|
|
||||||
value="public"
|
|
||||||
class="radio"
|
|
||||||
@change="onAccessChange">
|
|
||||||
<label for="public">
|
|
||||||
<span class="icon-link">
|
|
||||||
{{ t('forms', 'Share link') }}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<input id="selected"
|
|
||||||
v-model="form.access.type"
|
|
||||||
type="radio"
|
|
||||||
value="selected"
|
|
||||||
class="radio"
|
|
||||||
@change="onAccessChange">
|
|
||||||
<label for="selected">
|
|
||||||
<span class="icon-shared">
|
|
||||||
{{ t('forms', 'Choose users to share with') }}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
<ShareDiv v-show="form.access.type === 'selected'"
|
|
||||||
:user-shares="userShares"
|
|
||||||
:group-shares="groupShares"
|
|
||||||
@update:shares="onSharingChange" />
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</AppSidebar>
|
</AppSidebar>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -135,7 +130,6 @@ import { generateUrl } from '@nextcloud/router'
|
||||||
import { getLocale, getDayNamesShort, getMonthNamesShort } from '@nextcloud/l10n'
|
import { getLocale, getDayNamesShort, getMonthNamesShort } from '@nextcloud/l10n'
|
||||||
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
|
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
|
||||||
import { showError, showSuccess } from '@nextcloud/dialogs'
|
import { showError, showSuccess } from '@nextcloud/dialogs'
|
||||||
import ActionLink from '@nextcloud/vue/dist/Components/ActionLink'
|
|
||||||
import AppSidebar from '@nextcloud/vue/dist/Components/AppSidebar'
|
import AppSidebar from '@nextcloud/vue/dist/Components/AppSidebar'
|
||||||
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
|
import DatetimePicker from '@nextcloud/vue/dist/Components/DatetimePicker'
|
||||||
import moment from '@nextcloud/moment'
|
import moment from '@nextcloud/moment'
|
||||||
|
@ -147,7 +141,6 @@ export default {
|
||||||
name: 'Sidebar',
|
name: 'Sidebar',
|
||||||
|
|
||||||
components: {
|
components: {
|
||||||
ActionLink,
|
|
||||||
AppSidebar,
|
AppSidebar,
|
||||||
DatetimePicker,
|
DatetimePicker,
|
||||||
ShareDiv,
|
ShareDiv,
|
||||||
|
@ -177,6 +170,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
|
||||||
|
@ -337,7 +343,12 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.copyShareLink {
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
h3 {
|
h3 {
|
||||||
|
font-weight: bold;
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue