Add escape button handler for form (reset)
This commit is contained in:
parent
1f9a0ea586
commit
ee5dd22f5f
@ -11,6 +11,7 @@
|
||||
return {
|
||||
editing: false,
|
||||
saving: false,
|
||||
trackForReset: {},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -20,9 +21,17 @@
|
||||
},
|
||||
methods: {
|
||||
edit: function() {
|
||||
if (this.editing) {
|
||||
return;
|
||||
}
|
||||
this.trackForReset = Object.assign({}, this.track);
|
||||
this.saving = false;
|
||||
this.editing = true;
|
||||
},
|
||||
cancel: function() {
|
||||
this.track = Object.assign({}, this.trackForReset);
|
||||
this.editing = false;
|
||||
},
|
||||
save: function() {
|
||||
this.saving = true;
|
||||
|
||||
@ -55,7 +64,7 @@
|
||||
template: `
|
||||
<div class="media-track" @click="edit()">
|
||||
<template v-if="editing">
|
||||
<form method="patch" :action="patch_url">
|
||||
<form method="patch" :action="patch_url" @keyup.27="cancel">
|
||||
<select v-model="track.tag" :disabled="saving">
|
||||
<option value=""></option>
|
||||
<option :class="{unused: tag.tag_count == 0}" v-for="tag in tags">
|
||||
|
Loading…
Reference in New Issue
Block a user