Added Delete Button
authorAdam Dullage <redacted>
Thu, 17 Feb 2022 18:38:28 +0000 (18:38 +0000)
committerAdam Dullage <redacted>
Thu, 17 Feb 2022 18:38:28 +0000 (18:38 +0000)
README.md
flatnotes/src/components/App.js
flatnotes/src/components/App.vue

index 29fb72fc1954550e403f9d4c15fc7b4f0094205a..7501db356d6fd8671a8a39a82561c5ba896886c4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -36,8 +36,9 @@ This is what flatnotes aims to achieve.
 * [x] Ability to Rename a Note
 * [x] Routing
 * [x] e to edit
+* [x] Ability to Delete a Note
+* [ ] Exclude extension when renaming
 * [ ] Loading & Not Found Indicators
-* [ ] Ability to Delete a Note
 * [ ] / to search
 * [ ] CTRL-S to save
 * [ ] Drafts
index 675517a337f2d46f47da9252118939b743c83fb2..2c307a49e573a4b20fd0805e47303d75647c126a 100644 (file)
@@ -229,6 +229,18 @@ export default {
       this.toggleEditMode();
     },
 
+    deleteNote: function() {
+      if (
+        confirm(
+          `Are you sure you want to delete the note '${this.currentNote.title}'?`
+        )
+      ) {
+        api
+          .delete(`/api/notes/${this.currentNote.filename}`)
+          .then(window.open("/", "_self"));
+      }
+    },
+
     keyboardShortcuts: function(e) {
       // 'e' to Edit
       if (
index b960d40559fef916e7eb187cb1bec42d067a5700..13f12cb5202e5a16ba135dfb5c1ba4d64e6e8916 100644 (file)
           Edit
         </button>
 
+        <!-- Delete -->
+        <button
+          v-if="currentView == views.note && editMode == false"
+          type="button"
+          class="btn btn-danger mx-1"
+          @click="deleteNote"
+        >
+          Delete
+        </button>
+
         <!-- Cancel -->
         <button
           v-if="currentView == views.note && editMode == true"
git clone https://git.99rst.org/PROJECT