From eedd011c39d211a3928b5ca2bb7a901301a1c21a Mon Sep 17 00:00:00 2001 From: David Siegfried <david.siegfried@uni-vechta.de> Date: Fri, 5 Apr 2024 15:03:02 +0000 Subject: [PATCH] fixes #3914 Closes #3914 Merge request studip/studip!2813 --- .../components/questionnaires/InputArray.vue | 43 ++++++++++++++++--- .../components/questionnaires/VoteEdit.vue | 2 +- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/resources/vue/components/questionnaires/InputArray.vue b/resources/vue/components/questionnaires/InputArray.vue index 37fa6fc4285..0fd67db96db 100644 --- a/resources/vue/components/questionnaires/InputArray.vue +++ b/resources/vue/components/questionnaires/InputArray.vue @@ -19,17 +19,17 @@ <button class="as-link" :title="$gettext('Option lÃķschen')" @click.prevent="askForDeletingOption(index)"> - <studip-icon shape="trash" role="clickable" :size="20" alt=""></studip-icon> - </button> - <button v-if="index == options.length - 1" - class="as-link" - :title="$gettext('Option hinzufÞgen')" - @click.prevent="addOption"> - <studip-icon shape="add" role="clickable" :size="20" alt=""></studip-icon> + <studip-icon shape="trash" :role="options.length > 1 ? 'clickable' : 'inactive'" :size="20" alt=""></studip-icon> </button> </li> </draggable> + <button class="as-link" + :title="$gettext('Option hinzufÞgen')" + @click.prevent="addOption"> + <studip-icon shape="add" :size="20" alt=""></studip-icon> + </button> + <studip-dialog v-if="askForDeleting" :title="$gettext('Bitte bestÃĪtigen Sie die Aktion.')" @@ -90,6 +90,10 @@ export default { }); }, askForDeletingOption: function (index) { + if (this.options.length <= 1) { + return; + } + this.indexOfDeletingOption = index; if (this.value[index]) { this.askForDeleting = true; @@ -175,3 +179,28 @@ export default { } } </script> +<style lang="scss" scoped> +.input-array { + display: grid; + grid-template-areas: + "sr sr" + "options button"; + grid-template-columns: calc(100% - 24px) 24px; + grid-template-rows: auto; + + > .sr-only { + grid-area: sr; + } + + > .options { + grid-area: options; + } + + > button.as-link { + align-self: end; + grid-area: button; + justify-self: left; + margin-bottom: 8px; + } +} +</style> diff --git a/resources/vue/components/questionnaires/VoteEdit.vue b/resources/vue/components/questionnaires/VoteEdit.vue index 9acb01fafd6..62de963e8c3 100644 --- a/resources/vue/components/questionnaires/VoteEdit.vue +++ b/resources/vue/components/questionnaires/VoteEdit.vue @@ -56,7 +56,7 @@ export default { if (!this.value.description) { this.$emit('input', { multiplechoice: 1, - options: ['', '', '', ''] + options: ['', '', '', ''], }); } this.$refs.autofocus.focus(); -- GitLab