diff options
author | dartcafe <github@dartcafe.de> | 2020-10-14 12:04:04 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2020-10-14 12:04:04 +0300 |
commit | fe5199ffeb0977c85488ed0bada8c16e02b51702 (patch) | |
tree | 214304803ca8417c7e5d8f2e81b56bafc5c86181 /src/js/components/SideBar/SideBarTabConfiguration.vue | |
parent | 6ba1bf03d5c2ca65fc2518721c86b5dd0d83ebdf (diff) |
initial
Diffstat (limited to 'src/js/components/SideBar/SideBarTabConfiguration.vue')
-rw-r--r-- | src/js/components/SideBar/SideBarTabConfiguration.vue | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/src/js/components/SideBar/SideBarTabConfiguration.vue b/src/js/components/SideBar/SideBarTabConfiguration.vue index 5dc4f1e7..6da85392 100644 --- a/src/js/components/SideBar/SideBarTabConfiguration.vue +++ b/src/js/components/SideBar/SideBarTabConfiguration.vue @@ -48,14 +48,22 @@ type="checkbox" class="checkbox"> <label for="anonymous"> {{ t('polls', 'Anonymous poll') }}</label> + </ConfigBox> + + <ConfigBox :title="t('polls', 'Poll closing status')" :icon-class="expired ? 'icon-polls-closed' : 'icon-polls-open'"> + <ButtonDiv + :icon="expired ? 'icon-polls-open' : 'icon-polls-closed'" + :title="expired ? t('polls', 'Reopen poll'): t('polls', 'Close poll')" + @click="switchClosed()" /> - <input id="expiration" + <input v-show="!expired" + id="expiration" v-model="pollExpiration" type="checkbox" class="checkbox"> - <label for="expiration"> {{ t('polls', 'Expires') }}</label> + <label v-show="!expired" for="expiration"> {{ t('polls', 'Closing date') }}</label> - <DatetimePicker v-show="pollExpiration" v-model="pollExpire" v-bind="expirationDatePicker" /> + <DatetimePicker v-show="pollExpiration && !expired" v-model="pollExpire" v-bind="expirationDatePicker" /> </ConfigBox> <ConfigBox :title="t('polls', 'Access')" icon-class="icon-category-auth"> @@ -116,7 +124,7 @@ <script> import debounce from 'lodash/debounce' -import { mapState } from 'vuex' +import { mapGetters, mapState } from 'vuex' import { showSuccess, showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import moment from '@nextcloud/moment' @@ -146,6 +154,10 @@ export default { acl: state => state.poll.acl, }), + ...mapGetters({ + expired: 'poll/expired', + }), + // Add bindings pollDescription: { get() { @@ -199,10 +211,9 @@ export default { }, set(value) { if (value) { - this.writeValue({ expire: moment().unix() }) + this.writeValue({ expire: moment().add(1, 'week').unix() }) } else { this.writeValue({ expire: 0 }) - } }, }, @@ -271,17 +282,8 @@ export default { }, } }, - - saveButtonTitle: function() { - if (this.writingPoll) { - return t('polls', 'Writing poll') - } else if (this.acl.allowEdit) { - return t('polls', 'Update poll') - } else { - return t('polls', 'Create new poll') - } - }, }, + methods: { writeValueDebounced: debounce(function(e) { @@ -303,6 +305,15 @@ export default { }, + switchClosed() { + if (this.expired) { + this.writeValue({ expire: 0 }) + } else { + this.writeValue({ expire: moment.utc().unix() }) + } + + }, + deletePermanently() { if (!this.poll.deleted) return |