diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index b1754645..ad1df567 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -50,7 +50,6 @@ CURRENT TODOs @@@@@@@@@@@ ROADMAP STAGE 2: -todo: Customer login should have help links go to a special customer end user section in the manual, but they can still view the rest of the manual becuase maybe they will buy it todo: new widget - There should be a new option (in addition to duplicate) within the existing widget form because it makes sense to want to make a new one while editing previous one - Plus you could have arrived there from anywhere, don't want to have to reload a big list just to add a new one diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index 3dd80a49..51e69cd9 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -187,7 +187,7 @@ - + diff --git a/ayanova/src/views/widget.vue b/ayanova/src/views/widget.vue index 7014379e..a10bfcd7 100644 --- a/ayanova/src/views/widget.vue +++ b/ayanova/src/views/widget.vue @@ -341,25 +341,25 @@ export default { } //enable / disable save button - let canSave = val.dirty && val.valid && !val.readOnly; - if (canSave) { + if (val.dirty && val.valid && !val.readOnly) { window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save"); } else { window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":save"); } - //enable / disable duplicate button - let canDuplicate = !val.dirty && val.valid && !val.readOnly; - if (canDuplicate) { + //enable / disable duplicate / new button + if (!val.dirty && val.valid && !val.readOnly) { window.$gz.eventBus.$emit( "menu-enable-item", FORM_KEY + ":duplicate" ); + window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":new"); } else { window.$gz.eventBus.$emit( "menu-disable-item", FORM_KEY + ":duplicate" ); + window.$gz.eventBus.$emit("menu-disable-item", FORM_KEY + ":new"); } }, deep: true @@ -574,6 +574,12 @@ function clickHandler(menuItem) { case "delete": m.vm.remove(); break; + case "new": + m.vm.$router.push({ + name: "widget-edit", + params: { recordid: 0, new: true } + }); + break; case "duplicate": m.vm.duplicate(); break; @@ -657,6 +663,15 @@ function generateMenu(vm) { vm: vm }); + if (vm.rights.change) { + menuOptions.menuItems.push({ + title: vm.$ay.t("New"), + icon: "fa-plus", + key: FORM_KEY + ":new", + vm: vm + }); + } + if (vm.rights.change) { menuOptions.menuItems.push({ title: vm.$ay.t("Duplicate"),