diff options
author | dartcafe <github@dartcafe.de> | 2021-03-22 01:20:44 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2021-03-22 09:28:30 +0300 |
commit | e31a91655de85b97905b9053b83e923566bd4f0c (patch) | |
tree | 703ecb27315031ef08e811f4ced4d319999af84d /src/js | |
parent | 26f90b4126abc3731d46bb4c735e872d690eaba6 (diff) |
maintenance and tidy
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/components/Configuration/ConfigProposals.vue | 10 | ||||
-rw-r--r-- | src/js/components/Navigation/PollNavigationItems.vue | 1 | ||||
-rw-r--r-- | src/js/components/Options/OptionsDate.vue | 68 | ||||
-rw-r--r-- | src/js/components/Options/OptionsDateAdd.vue | 40 | ||||
-rw-r--r-- | src/js/components/Options/OptionsDateShift.vue | 30 | ||||
-rw-r--r-- | src/js/components/Options/OptionsText.vue | 60 | ||||
-rw-r--r-- | src/js/components/Options/OptionsTextAdd.vue | 8 | ||||
-rw-r--r-- | src/js/components/PollList/PollItem.vue | 10 | ||||
-rw-r--r-- | src/js/components/SideBar/SideBarTabOptions.vue | 33 | ||||
-rw-r--r-- | src/js/store/modules/poll.js | 8 | ||||
-rw-r--r-- | src/js/store/modules/polls.js | 10 | ||||
-rw-r--r-- | src/js/views/Vote.vue | 5 |
12 files changed, 132 insertions, 151 deletions
diff --git a/src/js/components/Configuration/ConfigProposals.vue b/src/js/components/Configuration/ConfigProposals.vue index 5ec05c2b..a0ae37ca 100644 --- a/src/js/components/Configuration/ConfigProposals.vue +++ b/src/js/components/Configuration/ConfigProposals.vue @@ -22,11 +22,9 @@ <template> <div> - <ConfigBox :title="t('polls', 'Allow Proposals from users')" icon-class="icon-category-customization"> - <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" /> - </ConfigBox> + <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" /> </div> </template> @@ -37,7 +35,6 @@ import { showSuccess, showError } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import moment from '@nextcloud/moment' import { DatetimePicker } from '@nextcloud/vue' -import ConfigBox from '../Base/ConfigBox' import CheckBoxDiv from '../Base/CheckBoxDiv' import RadioGroupDiv from '../Base/RadioGroupDiv' @@ -45,7 +42,6 @@ export default { name: 'ConfigProposals', components: { - ConfigBox, CheckBoxDiv, DatetimePicker, RadioGroupDiv, diff --git a/src/js/components/Navigation/PollNavigationItems.vue b/src/js/components/Navigation/PollNavigationItems.vue index 08dd9296..451a66a4 100644 --- a/src/js/components/Navigation/PollNavigationItems.vue +++ b/src/js/components/Navigation/PollNavigationItems.vue @@ -53,6 +53,7 @@ import moment from '@nextcloud/moment' export default { name: 'PollNavigationItems', + components: { ActionButton, AppNavigationItem, diff --git a/src/js/components/Options/OptionsDate.vue b/src/js/components/Options/OptionsDate.vue index 483e3c10..f0384600 100644 --- a/src/js/components/Options/OptionsDate.vue +++ b/src/js/components/Options/OptionsDate.vue @@ -22,41 +22,32 @@ <template> <div> - <ConfigBox v-if="countOptions" :title="t('polls', 'Available Options')" icon-class="icon-calendar-000"> - <transition-group is="ul"> - <OptionItem v-for="(option) in options" - :key="option.id" - :option="option" - :show-confirmed="true" - display="textBox" - tag="li"> - <template #actions> - <Actions v-if="acl.allowEdit" class="action"> - <ActionButton icon="icon-delete" @click="removeOption(option)"> - {{ t('polls', 'Delete option') }} - </ActionButton> - </Actions> - - <Actions v-if="acl.allowEdit" class="action"> - <ActionButton v-if="!pollIsClosed" icon="icon-polls-clone" @click="cloneOptionModal(option)"> - {{ t('polls', 'Clone option') }} - </ActionButton> - <ActionButton v-if="pollIsClosed" :icon="option.confirmed ? 'icon-polls-confirmed' : 'icon-polls-unconfirmed'" - @click="confirmOption(option)"> - {{ option.confirmed ? t('polls', 'Unconfirm option') : t('polls', 'Confirm option') }} - </ActionButton> - </Actions> - </template> - </OptionItem> - </transition-group> - </ConfigBox> - - <EmptyContent v-else icon="icon-calendar"> - {{ t('polls', 'No vote options') }} - <template #desc> - {{ t('polls', 'Add some!') }} - </template> - </EmptyContent> + <transition-group is="ul"> + <OptionItem v-for="(option) in options" + :key="option.id" + :option="option" + :show-confirmed="true" + display="textBox" + tag="li"> + <template #actions> + <Actions v-if="acl.allowEdit" class="action"> + <ActionButton icon="icon-delete" @click="removeOption(option)"> + {{ t('polls', 'Delete option') }} + </ActionButton> + </Actions> + + <Actions v-if="acl.allowEdit" class="action"> + <ActionButton v-if="!pollIsClosed" icon="icon-polls-clone" @click="cloneOptionModal(option)"> + {{ t('polls', 'Clone option') }} + </ActionButton> + <ActionButton v-if="pollIsClosed" :icon="option.confirmed ? 'icon-polls-confirmed' : 'icon-polls-unconfirmed'" + @click="confirmOption(option)"> + {{ option.confirmed ? t('polls', 'Unconfirm option') : t('polls', 'Confirm option') }} + </ActionButton> + </Actions> + </template> + </OptionItem> + </transition-group> <Modal v-if="cloneModal" :can-close="false"> <OptionCloneDate :option="optionToClone" class="modal__content" @close="closeModal()" /> @@ -67,10 +58,9 @@ <script> import { mapGetters, mapState } from 'vuex' import OptionCloneDate from './OptionCloneDate' -import ConfigBox from '../Base/ConfigBox' import OptionItem from './OptionItem' import moment from '@nextcloud/moment' -import { Actions, ActionButton, Modal, EmptyContent } from '@nextcloud/vue' +import { Actions, ActionButton, Modal } from '@nextcloud/vue' import { confirmOption, removeOption } from '../../mixins/optionMixins' import { dateUnits } from '../../mixins/dateMixins' @@ -80,10 +70,8 @@ export default { components: { Actions, ActionButton, - ConfigBox, - EmptyContent, - OptionCloneDate, Modal, + OptionCloneDate, OptionItem, }, diff --git a/src/js/components/Options/OptionsDateAdd.vue b/src/js/components/Options/OptionsDateAdd.vue index 815e1b3e..3eb5b125 100644 --- a/src/js/components/Options/OptionsDateAdd.vue +++ b/src/js/components/Options/OptionsDateAdd.vue @@ -21,32 +21,29 @@ --> <template> - <ConfigBox :title="t('polls', 'Add a date option')" icon-class="icon-add"> - <DatetimePicker v-model="pickedOption" - v-bind="optionDatePicker" - :open.sync="pickerOpen" - style="width: inherit;" - @pick="pickedDate"> - <template slot="footer"> - <CheckBoxDiv v-model="useRange" class="range" :label="t('polls', 'Select range')" /> - <button v-if="!showTimePanel" class="mx-btn" @click="toggleTimePanel"> - {{ t('polls', 'Add time') }} - </button> - <button v-else class="mx-btn" @click="toggleTimePanel"> - {{ t('polls', 'Remove time') }} - </button> - <button class="mx-btn" @click="addOption"> - {{ t('polls', 'OK') }} - </button> - </template> - </DateTimePicker> - </ConfigBox> + <DatetimePicker v-model="pickedOption" + v-bind="optionDatePicker" + :open.sync="pickerOpen" + style="width: inherit;" + @pick="pickedDate"> + <template slot="footer"> + <CheckBoxDiv v-model="useRange" class="range" :label="t('polls', 'Select range')" /> + <button v-if="!showTimePanel" class="mx-btn" @click="toggleTimePanel"> + {{ t('polls', 'Add time') }} + </button> + <button v-else class="mx-btn" @click="toggleTimePanel"> + {{ t('polls', 'Remove time') }} + </button> + <button class="mx-btn" @click="addOption"> + {{ t('polls', 'OK') }} + </button> + </template> + </DateTimePicker> </template> <script> import CheckBoxDiv from '../Base/CheckBoxDiv' -import ConfigBox from '../Base/ConfigBox' import moment from '@nextcloud/moment' import { DatetimePicker } from '@nextcloud/vue' @@ -55,7 +52,6 @@ export default { components: { CheckBoxDiv, - ConfigBox, DatetimePicker, }, diff --git a/src/js/components/Options/OptionsDateShift.vue b/src/js/components/Options/OptionsDateShift.vue index 575a69fd..9203defa 100644 --- a/src/js/components/Options/OptionsDateShift.vue +++ b/src/js/components/Options/OptionsDateShift.vue @@ -21,28 +21,25 @@ --> <template> - <ConfigBox :title="t('polls', 'Shift all date options')" icon-class="icon-polls-move"> - <div> - <div class="selectUnit"> - <InputDiv v-model="shift.step" - use-num-modifiers - @add="shift.step++" - @subtract="shift.step--" /> - <Multiselect v-model="shift.unit" - :options="dateUnits" - label="name" - track-by="value" /> - <ButtonDiv submit - @click="shiftDates(shift)" /> - </div> + <div> + <div class="selectUnit"> + <InputDiv v-model="shift.step" + use-num-modifiers + @add="shift.step++" + @subtract="shift.step--" /> + <Multiselect v-model="shift.unit" + :options="dateUnits" + label="name" + track-by="value" /> + <ButtonDiv submit + @click="shiftDates(shift)" /> </div> - </ConfigBox> + </div> </template> <script> import { mapState } from 'vuex' -import ConfigBox from '../Base/ConfigBox' import InputDiv from '../Base/InputDiv' import moment from '@nextcloud/moment' import { Multiselect } from '@nextcloud/vue' @@ -52,7 +49,6 @@ export default { name: 'OptionsDateShift', components: { - ConfigBox, InputDiv, Multiselect, }, diff --git a/src/js/components/Options/OptionsText.vue b/src/js/components/Options/OptionsText.vue index 51e4eed5..83511451 100644 --- a/src/js/components/Options/OptionsText.vue +++ b/src/js/components/Options/OptionsText.vue @@ -21,45 +21,33 @@ --> <template> - <div> - <ConfigBox v-if="countOptions" :title="t('polls', 'Available Options')" icon-class="icon-toggle-filelist"> - <draggable v-model="reOrderedOptions"> - <transition-group> - <OptionItem v-for="(option) in reOrderedOptions" - :key="option.id" - :option="option" - :draggable="true"> - <template #actions> - <Actions v-if="acl.allowEdit" class="action"> - <ActionButton icon="icon-delete" @click="removeOption(option)"> - {{ t('polls', 'Delete option') }} - </ActionButton> - </Actions> - <Actions v-if="acl.allowEdit" class="action"> - <ActionButton v-if="PollIsClosed" :icon="option.confirmed ? 'icon-polls-yes' : 'icon-checkmark'" - @click="confirmOption(option)"> - {{ option.confirmed ? t('polls', 'Unconfirm option') : t('polls', 'Confirm option') }} - </ActionButton> - </Actions> - </template> - </OptionItem> - </transition-group> - </draggable> - </ConfigBox> - - <EmptyContent v-else icon="icon-toggle-filelist"> - {{ t('polls', 'No vote options') }} - <template #desc> - {{ t('polls', 'Add some!') }} - </template> - </EmptyContent> - </div> + <draggable v-model="reOrderedOptions"> + <transition-group> + <OptionItem v-for="(option) in reOrderedOptions" + :key="option.id" + :option="option" + :draggable="true"> + <template #actions> + <Actions v-if="acl.allowEdit" class="action"> + <ActionButton icon="icon-delete" @click="removeOption(option)"> + {{ t('polls', 'Delete option') }} + </ActionButton> + </Actions> + <Actions v-if="acl.allowEdit" class="action"> + <ActionButton v-if="PollIsClosed" :icon="option.confirmed ? 'icon-polls-yes' : 'icon-checkmark'" + @click="confirmOption(option)"> + {{ option.confirmed ? t('polls', 'Unconfirm option') : t('polls', 'Confirm option') }} + </ActionButton> + </Actions> + </template> + </OptionItem> + </transition-group> + </draggable> </template> <script> import { mapGetters, mapState } from 'vuex' -import { Actions, ActionButton, EmptyContent } from '@nextcloud/vue' -import ConfigBox from '../Base/ConfigBox' +import { Actions, ActionButton } from '@nextcloud/vue' import draggable from 'vuedraggable' import OptionItem from './OptionItem' import { confirmOption, removeOption } from '../../mixins/optionMixins' @@ -70,9 +58,7 @@ export default { components: { Actions, ActionButton, - ConfigBox, draggable, - EmptyContent, OptionItem, }, diff --git a/src/js/components/Options/OptionsTextAdd.vue b/src/js/components/Options/OptionsTextAdd.vue index d93b5c96..228ab3ed 100644 --- a/src/js/components/Options/OptionsTextAdd.vue +++ b/src/js/components/Options/OptionsTextAdd.vue @@ -21,22 +21,18 @@ --> <template> - <ConfigBox v-if="!closed" :title="t('polls', 'Add a new text option')" icon-class="icon-add"> - <InputDiv v-model="newPollText" :placeholder="t('polls', 'Enter option text')" - @submit="addOption()" /> - </ConfigBox> + <InputDiv v-model="newPollText" :placeholder="t('polls', 'Enter option text')" + @submit="addOption()" /> </template> <script> import { mapGetters } from 'vuex' -import ConfigBox from '../Base/ConfigBox' import InputDiv from '../Base/InputDiv' export default { name: 'OptionsTextAdd', components: { - ConfigBox, InputDiv, }, diff --git a/src/js/components/PollList/PollItem.vue b/src/js/components/PollList/PollItem.vue index 8ff74858..9c098dbc 100644 --- a/src/js/components/PollList/PollItem.vue +++ b/src/js/components/PollList/PollItem.vue @@ -78,7 +78,7 @@ <div class="item__expiry"> <Badge :title="timeExpirationRelative" - :icon="expiryIcon" + icon="icon-calendar-000" :class="expiryClass" /> </div> </div> @@ -176,13 +176,7 @@ export default { return 'success' } }, - expiryIcon() { - if (this.poll.expire) { - return 'icon-calendar-000' - } else { - return 'icon-calendar-000' - } - }, + timeCreatedRelative() { return moment.unix(this.poll.created).fromNow() }, diff --git a/src/js/components/SideBar/SideBarTabOptions.vue b/src/js/components/SideBar/SideBarTabOptions.vue index d786d50c..c56106d8 100644 --- a/src/js/components/SideBar/SideBarTabOptions.vue +++ b/src/js/components/SideBar/SideBarTabOptions.vue @@ -23,18 +23,36 @@ <template> <div> <ConfigBox v-if="!isOwner" :title="t('polls', 'As an admin you may edit this poll')" icon-class="icon-checkmark" /> - <ConfigProposals /> - <OptionsDateAdd v-if="pollType === 'datePoll' && !pollIsClosed" /> - <OptionsDateShift v-if="pollType === 'datePoll' && countOptions && !pollIsClosed" /> - <OptionsDate v-if="pollType === 'datePoll'" /> + <ConfigBox :title="t('polls', 'Allow Proposals from users')" icon-class="icon-category-customization"> + <ConfigProposals /> + </ConfigBox> - <OptionsTextAdd v-if="pollType === 'textPoll' && !pollIsClosed" /> - <OptionsText v-if="pollType === 'textPoll'" /> + <ConfigBox v-if="!pollIsClosed" :title="t('polls', 'Add an option')" icon-class="icon-add"> + <OptionsDateAdd v-if="pollType === 'datePoll'" /> + <OptionsTextAdd v-else-if="pollType === 'textPoll'" /> + </ConfigBox> + + <ConfigBox v-if="pollType === 'datePoll' && countOptions && !pollIsClosed" :title="t('polls', 'Shift all date options')" icon-class="icon-polls-move"> + <OptionsDateShift /> + </ConfigBox> + + <ConfigBox v-if="countOptions" :title="t('polls', 'Available Options')" :icon-class="pollTypeIcon"> + <OptionsDate v-if="pollType === 'datePoll'" /> + <OptionsText v-else-if="pollType === 'textPoll'" /> + </ConfigBox> + + <EmptyContent v-else :icon="pollTypeIcon"> + {{ t('polls', 'No vote options') }} + <template #desc> + {{ t('polls', 'Add some!') }} + </template> + </EmptyContent> </div> </template> <script> import { mapGetters, mapState } from 'vuex' +import { EmptyContent } from '@nextcloud/vue' import ConfigBox from '../Base/ConfigBox' import OptionsDate from '../Options/OptionsDate' import OptionsDateAdd from '../Options/OptionsDateAdd' @@ -49,6 +67,7 @@ export default { components: { ConfigBox, ConfigProposals, + EmptyContent, OptionsDate, OptionsDateAdd, OptionsDateShift, @@ -60,12 +79,12 @@ export default { ...mapGetters({ pollIsClosed: 'poll/closed', countOptions: 'options/count', + pollTypeIcon: 'poll/typeIcon', }), ...mapState({ pollType: state => state.poll.type, isOwner: state => state.poll.acl.isOwner, }), - }, } </script> diff --git a/src/js/store/modules/poll.js b/src/js/store/modules/poll.js index 55a7065f..8b14a98e 100644 --- a/src/js/store/modules/poll.js +++ b/src/js/store/modules/poll.js @@ -79,6 +79,14 @@ const mutations = { } const getters = { + typeIcon: (state) => { + if (state.type === 'textPoll') { + return 'icon-toggle-filelist' + } else { + return 'icon-calendar-000' + } + }, + answerSequence: (state) => { if (state.allowMaybe) { return ['no', 'yes', 'maybe'] diff --git a/src/js/store/modules/polls.js b/src/js/store/modules/polls.js index 44ecc158..2596aafd 100644 --- a/src/js/store/modules/polls.js +++ b/src/js/store/modules/polls.js @@ -47,18 +47,18 @@ const state = { }, { id: 'hidden', - title: t('polls', 'Hidden'), + title: t('polls', 'Hidden polls'), titleExt: t('polls', 'Hidden polls'), description: t('polls', 'All hidden polls, to which you have access.'), - icon: 'icon-polls', + icon: 'icon-polls-hidden-poll', pinned: false, }, { id: 'participated', - title: t('polls', 'Participated by me'), - titleExt: t('polls', 'Participated by me'), + title: t('polls', 'Participated'), + titleExt: t('polls', 'Participated'), description: t('polls', 'All polls, where you placed a vote.'), - icon: 'icon-polls', + icon: 'icon-polls-confirmed', pinned: false, }, { diff --git a/src/js/views/Vote.vue b/src/js/views/Vote.vue index f87d4d17..1699752b 100644 --- a/src/js/views/Vote.vue +++ b/src/js/views/Vote.vue @@ -37,7 +37,7 @@ :class="expiryClass" /> <Badge v-if="!closed && poll.expire" :title="t('polls', 'Closing {relativeExpirationTime}', {relativeExpirationTime: timeExpirationRelative})" - icon="icon-calendar-000" + icon="icon-calendar" :class="expiryClass" /> <Badge v-if="poll.deleted" :title="t('polls', 'Deleted')" @@ -57,7 +57,7 @@ <div class="area__main" :class="viewMode"> <VoteTable v-show="options.length" :view-mode="viewMode" /> - <EmptyContent v-if="!options.length" icon="icon-toggle-filelist"> + <EmptyContent v-if="!options.length" :icon="pollTypeIcon"> {{ t('polls', 'No vote options available') }} <template #desc> <button v-if="acl.allowEdit" @click="openOptions"> @@ -139,6 +139,7 @@ export default { options: 'options/rankedOptions', closed: 'poll/closed', viewMode: 'settings/viewMode', + pollTypeIcon: 'poll/typeIcon', }), showEmailEdit() { |