From 30348187f5d1a49908661c2eb2c50eef17ebca80 Mon Sep 17 00:00:00 2001 From: sanjayk03-dev Date: Mon, 29 Jan 2024 01:58:51 +0530 Subject: [PATCH] fixed delete bug --- src/js/macros.js | 4 +++- src/pug/templates/macros.pug | 4 ++-- src/stylus/style.styl | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/js/macros.js b/src/js/macros.js index 08bdfca..9a1a285 100644 --- a/src/js/macros.js +++ b/src/js/macros.js @@ -205,7 +205,7 @@ module.exports = { this.config.macros[this.tab - 1].file_name = "default"; } else { api.delete(`file/${filename}`); - this.$set("newGcode[this.tab]", ""); + this.$set("newGcode[this.tab-1]", ""); this.config.macros[this.tab - 1].file_name = "default"; this.config.macrosList = this.config.macrosList.filter(item => item.file_name !== filename); } @@ -216,6 +216,7 @@ module.exports = { console.error("Restore Failed: ", error); alert("Restore failed"); } + this.tab = "1"; this.deleteGCode = false; }, delete_all_macros: async function () { @@ -279,6 +280,7 @@ module.exports = { ]; this.delete_all_macros(); this.cancelMacros(); + this.tab = "1"; this.confirmReset = false; try { await api.put("config/save", this.config); diff --git a/src/pug/templates/macros.pug b/src/pug/templates/macros.pug index 0b452c7..26f4e7b 100644 --- a/src/pug/templates/macros.pug +++ b/src/pug/templates/macros.pug @@ -41,7 +41,7 @@ script#macros-template(type="text/x-template") .flex-row-container button.blue-button(title="Reset Macros", @click="confirmReset=true") Delete All button.blue-button(title="Add a Macros", @click="addNewMacros", style="margin-left:5px") New Macros - button.blue-button(title="Add a Macros", @click="deleteSelected=true", style="margin-left:5px",:disabled="!macrosLength") Delete Selected + // button.blue-button(title="Delete a Macros", @click="deleteSelected=true", style="margin-left:5px",:disabled="!macrosLength") Delete Selected .tabs input#tab1(type="radio", name="tabs",checked="" @click="tab = '1'") @@ -51,7 +51,7 @@ script#macros-template(type="text/x-template") input(type="radio",:id="'tab'+(index+2)", name="tabs",@click="tab = (index+2).toString()") label(:for="'tab'+(index+2)",style="height:50px;width:100px") Macros {{index+2}} - section.tab-content(v-for="(index,macros) in config.macros",:id="'content'+(index+1)") + section.macros-tab-content(v-for="(index,macros) in config.macros",:id="'content'+(index+1)") .macros-form p.title Name .input-container diff --git a/src/stylus/style.styl b/src/stylus/style.styl index f86be1e..4447cf0 100644 --- a/src/stylus/style.styl +++ b/src/stylus/style.styl @@ -650,7 +650,7 @@ span.unit border-radius 10px border-color #424242 border-style solid - + .new-gcode height 13rem width 23rem @@ -660,14 +660,21 @@ span.unit .flex-row-container display flex flex-direction row + width 440px margin-bottom 1rem .tabs margin-top 5px + width 850px + .macros-view padding 30px width 95% + + .macros-tab-content + padding-bottom 20px + border-radius 5px .macros-form padding-left 30px