enabling submitting dialogs via enter key where appropriate

This commit is contained in:
Benjamin Smith 2021-07-16 15:13:29 -04:00
parent defea1e1a2
commit 13fc3c7aa9
3 changed files with 16 additions and 6 deletions

View file

@ -25,9 +25,10 @@
ref="newProjectInput"
style="width: 400px;"
label="New project name"
v-model="newProjectName"
v-model.trim="newProjectName"
:error="isInvalid && newProjectName.length > 0"
:error-message="'Your project name contains invalid characters'"
@keydown.enter.prevent="createNewProject"
/>
</div>
@ -147,6 +148,8 @@ export default class NewProjectCheck extends DialogBase {
* Create new project
*/
createNewProject () {
if (this.isInvalid) return
Loading.show({
message: "<h4>Setting up a new project...</h4>",
spinnerColor: "primary",

View file

@ -19,6 +19,7 @@
v-model="projectName"
:error="isInvalid"
:error-message="'Your project name contains invalid characters or is empty'"
@keydown.enter.prevent="saveProjectSettings"
/>
</div>
@ -114,6 +115,8 @@ export default class ProjectSettingsDialog extends DialogBase {
}
async saveProjectSettings () {
if (this.isInvalid) return
const newSettings = {
projectName: this.projectName
}

View file

@ -25,6 +25,7 @@
style="width: 400px;"
label="New tag name"
v-model="newTagName"
@keydown.enter.prevent="renameTags"
/>
</div>
@ -39,7 +40,7 @@
<q-btn
flat
label="Rename tag"
:disable="newTagName.length <= 0"
:disable="isInvalid"
color="primary"
@click="renameTags" />
</q-card-actions>
@ -99,16 +100,19 @@ export default class RenameTagPrompt extends DialogBase {
@Prop(({ default: "" })) readonly targetTag!: ""
/**
* Model for the new project name
* Model for the new tag name
*/
newTagName = ""
documentsCopy:I_OpenedDocument[] = []
/**
* Create new project
*/
get isInvalid () {
return this.newTagName.length <= 0
}
async renameTags () {
if (this.isInvalid) return
Loading.show({
message: "<h4>Renaming tags in all affected documents...</h4>",
spinnerColor: "primary",