From 966c9bf0e45f4ce7b03a85a5921e240ad412f964 Mon Sep 17 00:00:00 2001 From: James Chang Date: Tue, 13 Apr 2021 12:10:32 -0400 Subject: [PATCH] Add ability to copy/duplicate existing records --- .../components/dialog/editRecordDialog.vue | 100 ++------- .../help/viewPbCardInterface/helpButton.vue | 7 +- frontend/components/input/genericInput.vue | 19 +- .../interface/crud/crudRecordInterface.vue | 159 ++------------ .../interface/crud/editRecordInterface.vue | 2 +- .../special/crudPersonalBestInterface.vue | 201 +++--------------- .../special/editPersonalBestInterface.vue | 2 +- .../crud/special/viewUserInterface.vue | 2 +- .../interface/crud/viewRecordInterface.vue | 2 +- frontend/components/menu/recordActionMenu.vue | 148 +++++++++++++ frontend/components/page/viewRecordPage.vue | 75 ++----- frontend/mixins/crud.js | 2 + frontend/mixins/editRecordInterface.js | 36 +++- frontend/models/personalBest.ts | 4 + frontend/types/index.ts | 7 + 15 files changed, 289 insertions(+), 477 deletions(-) create mode 100644 frontend/components/menu/recordActionMenu.vue diff --git a/frontend/components/dialog/editRecordDialog.vue b/frontend/components/dialog/editRecordDialog.vue index 85b9cc2..960ecb1 100644 --- a/frontend/components/dialog/editRecordDialog.vue +++ b/frontend/components/dialog/editRecordDialog.vue @@ -21,82 +21,15 @@ {{ title }} - - - - - - - mdi-open-in-new - - Go To Page - mdi-open-in-new - - - - - mdi-eye - - View - - - - mdi-share-variant - - Share - - - - mdi-pencil - - Edit - - - - mdi-delete - - Delete - - - - - {{ item.icon || item.recordInfo.icon }} - - {{ item.name || item.recordInfo.name }} - mdi-open-in-new - - - - + mdi-close @@ -114,6 +47,8 @@ import EditRecordInterface from '~/components/interface/crud/editRecordInterface import ViewRecordInterface from '~/components/interface/crud/viewRecordInterface.vue' import DeleteRecordInterface from '~/components/interface/crud/deleteRecordInterface.vue' import ShareRecordInterface from '~/components/interface/crud/shareRecordInterface.vue' +import RecordActionMenu from '~/components/menu/recordActionMenu.vue' + import { goToPage } from '~/services/base' const modesMap = { @@ -122,6 +57,11 @@ const modesMap = { prefix: 'New', defaultInterface: EditRecordInterface, }, + copy: { + icon: 'mdi-content-copy', + prefix: 'Copy', + defaultInterface: EditRecordInterface, + }, edit: { icon: 'mdi-pencil', prefix: 'Edit', @@ -145,6 +85,10 @@ const modesMap = { } export default { + components: { + RecordActionMenu, + }, + props: { status: { type: Boolean, @@ -165,7 +109,9 @@ export default { type: String, required: true, validator: (value) => { - return ['add', 'edit', 'view', 'delete', 'share'].includes(value) + return ['add', 'edit', 'view', 'delete', 'copy', 'share'].includes( + value + ) }, }, diff --git a/frontend/components/help/viewPbCardInterface/helpButton.vue b/frontend/components/help/viewPbCardInterface/helpButton.vue index 3e1861a..1dcd544 100644 --- a/frontend/components/help/viewPbCardInterface/helpButton.vue +++ b/frontend/components/help/viewPbCardInterface/helpButton.vue @@ -1,5 +1,5 @@