aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Siegfried <david.siegfried@uni-vechta.de>2024-04-05 15:03:02 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-04-05 15:03:02 +0000
commiteedd011c39d211a3928b5ca2bb7a901301a1c21a (patch)
treec9a2efa6d04512b81222e873a37e1b3d306ee2b1
parent864f80040952304c52b0af5a9ec75f849d9e8cc7 (diff)
fixes #3914
Closes #3914 Merge request studip/studip!2813
-rw-r--r--resources/vue/components/questionnaires/InputArray.vue43
-rw-r--r--resources/vue/components/questionnaires/VoteEdit.vue2
2 files changed, 37 insertions, 8 deletions
diff --git a/resources/vue/components/questionnaires/InputArray.vue b/resources/vue/components/questionnaires/InputArray.vue
index 37fa6fc..0fd67db 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 9acb01f..62de963 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();