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/components/Options | |
parent | 26f90b4126abc3731d46bb4c735e872d690eaba6 (diff) |
maintenance and tidy
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'src/js/components/Options')
-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 |
5 files changed, 84 insertions, 122 deletions
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, }, |