Skip to content

Commit

Permalink
[feature] speedup alteri entry by automatically add next alter #61
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-rind committed Dec 3, 2021
1 parent 7d11c56 commit 82ba20e
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/components/AlteriEditForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<p class="label">Kontakt bearbeiten</p>
<p class="label" v-if="addingNewAlter">Kontakt hinzufügen</p>
<p class="label" v-else>Kontakt bearbeiten</p>
<form class="form" @submit.prevent="editAlterFinished">
<div class="field has-text-danger" v-if="invalidPosition">
<span class="icon is-small">
Expand Down Expand Up @@ -195,6 +196,17 @@
class="button is-primary"
ref="domButton"
:disabled="invalidName || invalidPosition"
>
{{ addingNewAlter ? "Nächster Kontakt" : "Schließen" }}
</button>
</p>
<p class="control">
<button
v-if="addingNewAlter"
class="button is-light"
:disabled="invalidName || invalidPosition"
type="button"
@mouseup.prevent="editAlterFinished(false)"
>
Schließen
</button>
Expand Down Expand Up @@ -328,7 +340,7 @@ export default defineComponent({
}
);
const editAlterFinished = () => {
const editAlterFinished = (allowAddNext = true) => {
// TODO if (!this.invalidPosition && !this.invalidName) {
if (invalidName.value) {
// moving mouse cursor does not work
Expand All @@ -339,6 +351,10 @@ export default defineComponent({
} else {
(domButton.value as HTMLButtonElement).focus();
store.commit("view/closeAlterForm");
if (addingNewAlter.value && allowAddNext) {
store.commit("addAlter");
}
}
};
Expand Down

0 comments on commit 82ba20e

Please sign in to comment.