Signed-off-by: dartcafe <github@dartcafe.de>
This commit is contained in:
dartcafe 2021-03-25 09:52:22 +01:00
Родитель 2073d6286b
Коммит b863a1d447
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CCE73CEF3035D3C8
8 изменённых файлов: 43 добавлений и 15 удалений

Просмотреть файл

@ -87,7 +87,7 @@ class Poll extends Entity implements JsonSerializable {
public const SHOW_RESULTS_NEVER = 'never';
public const PROPOSAL_DISALLOW = 'disallow';
public const PROPOSAL_ALLOW = 'allow';
public const PROPOSAL_RELEASE = 'release';
public const PROPOSAL_RELEASE = 'review';
/** @var string $type */
protected $type;

Просмотреть файл

@ -22,15 +22,15 @@
<template>
<div>
<RadioGroupDiv v-model="allowProposals" :options="allowProposalsOptions" />
<CheckBoxDiv v-show="allowProposals !== 'disallow'" v-model="pollExpiration" :label="t('polls', 'Closing Date')" />
<DatetimePicker v-show="pollExpiration && allowProposals !== 'disallow'" v-model="pollExpire" v-bind="expirationDatePicker" />
<RadioGroupDiv v-model="allowProposals" :options="proposalsOptions" />
<CheckBoxDiv v-show="proposalsAllowed" v-model="pollExpiration" :label="t('polls', 'Closing Date')" />
<DatetimePicker v-show="pollExpiration && proposalsAllowed" v-model="pollExpire" v-bind="expirationDatePicker" />
</div>
</template>
<script>
import debounce from 'lodash/debounce'
import { mapState } from 'vuex'
import { mapState, mapGetters } from 'vuex'
import { showSuccess, showError } from '@nextcloud/dialogs'
import { emit } from '@nextcloud/event-bus'
import moment from '@nextcloud/moment'
@ -50,11 +50,6 @@ export default {
data() {
return {
titleEmpty: false,
allowProposalsOptions: [
{ value: 'disallow', label: t('polls', 'Disallow Proposals') },
{ value: 'allow', label: t('polls', 'Allow Proposals') },
{ value: 'release', label: t('polls', 'Allow with review') },
],
}
},
@ -63,6 +58,11 @@ export default {
poll: state => state.poll,
}),
...mapGetters({
proposalsAllowed: 'poll/proposalsAllowed',
proposalsOptions: 'poll/proposalsOptions',
}),
// Add bindings
allowProposals: {
get() {

Просмотреть файл

@ -82,6 +82,7 @@ export default {
<style lang="scss" scoped>
.option-item-owner {
display: flex;
align-items: center;
justify-content: center;
background-repeat: no-repeat;

Просмотреть файл

@ -22,7 +22,10 @@
<template>
<div>
<div class="selectUnit">
<div v-if="proposalsExist">
{{ t('polls', 'Shifting dates is disabled to prevent shifting of other user\'s proposals.') }}
</div>
<div v-else class="selectUnit">
<InputDiv v-model="shift.step"
use-num-modifiers
@add="shift.step++"
@ -39,7 +42,7 @@
<script>
import { mapState } from 'vuex'
import { mapState, mapGetters } from 'vuex'
import InputDiv from '../Base/InputDiv'
import moment from '@nextcloud/moment'
import { Multiselect } from '@nextcloud/vue'
@ -75,6 +78,10 @@ export default {
options: state => state.options.list,
}),
...mapGetters({
proposalsExist: 'options/proposalsExist',
}),
firstDOW() {
// vue2-datepicker needs 7 for sunday
if (moment.localeData()._week.dow === 0) {

Просмотреть файл

@ -36,7 +36,7 @@
</ActionButton>
</Actions>
</UserItem>
<div v-if="acl.allowAddOptions" class="owner" />
<div v-if="proposalsExist" class="owner" />
<div v-if="acl.allowEdit && closed" class="confirm" />
</div>
@ -55,7 +55,7 @@
:class="{currentuser: participant.userId === acl.userId}">
<VoteItem :user-id="participant.userId" :option="option" />
</div>
<OptionItemOwner v-if="acl.allowAddOptions" :option="option" class="owner" />
<OptionItemOwner v-if="proposalsExist" :option="option" class="owner" />
<Actions v-if="acl.allowEdit && closed" class="action confirm">
<ActionButton v-if="closed" :icon="option.confirmed ? 'icon-polls-confirmed' : 'icon-polls-unconfirmed'"
@click="confirmOption(option)">
@ -136,6 +136,7 @@ export default {
closed: 'poll/closed',
participants: 'poll/participants',
options: 'options/rankedOptions',
proposalsExist: 'options/proposalsExist',
}),
},

Просмотреть файл

@ -95,6 +95,12 @@ const getters = {
return orderBy(state.list, state.ranked ? 'rank' : 'order', 'asc')
},
proposalsExist: (state) => {
return !!state.list.filter(option => {
return option.owner
}).length
},
confirmed: state => {
return state.list.filter(option => {
return option.confirmed > 0

Просмотреть файл

@ -95,6 +95,18 @@ const getters = {
}
},
proposalsAllowed: (state) => {
return (state.allowProposals === 'allow' || state.allowProposals === 'review')
},
proposalsOptions: () => {
return [
{ value: 'disallow', label: t('polls', 'Disallow Proposals') },
{ value: 'allow', label: t('polls', 'Allow Proposals') },
{ value: 'review', label: t('polls', 'Allow with review') },
]
},
closed: (state) => {
return (state.expire > 0 && moment.unix(state.expire).diff() < 0)
},

Просмотреть файл

@ -47,7 +47,7 @@
<div class="area__header__description">
<MarkUpDescription />
<OptionProposals v-if="acl.allowAddOptions" />
<OptionProposals v-if="acl.allowAddOptions && proposalsAllowed" />
</div>
</div>
@ -135,6 +135,7 @@ export default {
options: 'options/rankedOptions',
pollTypeIcon: 'poll/typeIcon',
viewMode: 'settings/viewMode',
proposalsAllowed: 'poll/proposalsAllowed',
}),
showEmailEdit() {