Skip to content

Commit

Permalink
Add ability to copy/duplicate existing records
Browse files Browse the repository at this point in the history
  • Loading branch information
big213 committed Apr 13, 2021
1 parent 1fbd09d commit 966c9bf
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 477 deletions.
100 changes: 23 additions & 77 deletions frontend/components/dialog/editRecordDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,82 +21,15 @@
<span class="headline">{{ title }}</span>
</v-toolbar-title>
<v-spacer></v-spacer>
<v-menu v-if="computedMode !== 'add'" left offset-x>
<template v-slot:activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="on">mdi-dots-vertical</v-icon>
</template>

<v-list dense>
<v-list-item
v-if="recordInfo.enterOptions"
key="enter"
@click="goToPage(true)"
>
<v-list-item-icon>
<v-icon>mdi-open-in-new</v-icon>
</v-list-item-icon>
<v-list-item-title
>Go To Page
<v-icon small right>mdi-open-in-new</v-icon>
</v-list-item-title>
</v-list-item>
<v-list-item
v-if="recordInfo.shareOptions"
key="view"
@click="openEditDialog('view')"
>
<v-list-item-icon>
<v-icon>mdi-eye</v-icon>
</v-list-item-icon>
<v-list-item-title>View</v-list-item-title>
</v-list-item>
<v-list-item
v-if="recordInfo.shareOptions"
key="share"
@click="openEditDialog('share')"
>
<v-list-item-icon>
<v-icon>mdi-share-variant</v-icon>
</v-list-item-icon>
<v-list-item-title>Share</v-list-item-title>
</v-list-item>
<v-list-item
v-if="recordInfo.editOptions"
key="edit"
@click="openEditDialog('edit')"
>
<v-list-item-icon>
<v-icon>mdi-pencil</v-icon>
</v-list-item-icon>
<v-list-item-title>Edit</v-list-item-title>
</v-list-item>
<v-list-item
v-if="recordInfo.deleteOptions"
key="delete"
@click="openEditDialog('delete')"
>
<v-list-item-icon>
<v-icon>mdi-delete</v-icon>
</v-list-item-icon>
<v-list-item-title>Delete</v-list-item-title>
</v-list-item>
<v-divider v-if="recordInfo.expandTypes.length > 0"></v-divider>
<v-list-item
v-for="(item, i) in recordInfo.expandTypes"
:key="i"
dense
@click="goToPage(true, i)"
>
<v-list-item-icon>
<v-icon>{{ item.icon || item.recordInfo.icon }}</v-icon>
</v-list-item-icon>
<v-list-item-title
>{{ item.name || item.recordInfo.name }}
<v-icon small right>mdi-open-in-new</v-icon>
</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<RecordActionMenu
v-if="computedMode !== 'add'"
:record-info="recordInfo"
:item="selectedItem"
expand-mode="openInNew"
left
offset-x
@handle-action-click="openEditDialog"
></RecordActionMenu>
<v-btn icon @click="close()">
<v-icon>mdi-close</v-icon>
</v-btn>
Expand All @@ -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 = {
Expand All @@ -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',
Expand All @@ -145,6 +85,10 @@ const modesMap = {
}
export default {
components: {
RecordActionMenu,
},
props: {
status: {
type: Boolean,
Expand All @@ -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
)
},
},
Expand Down
7 changes: 3 additions & 4 deletions frontend/components/help/viewPbCardInterface/helpButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-dialog v-model="dialog" width="500">
<v-dialog v-model="dialog" width="500" scrollable>
<template v-slot:activator="{ on, attrs }">
<v-btn icon v-bind="attrs" v-on="on">
<v-icon>mdi-help</v-icon>
Expand All @@ -8,7 +8,7 @@
<v-card>
<v-card-title class="headline"> How to Use This Page </v-card-title>

<v-card-text>
<v-card-text style="max-height: 600px">
This page shows all of the events alongside several commonly-used PB
types, like Single, Ao5, Ao12, etc.
<br /><br />
Expand All @@ -23,10 +23,9 @@
If you notice an error with one of the PBs that you have entered (for
example, a typo), you can remove that PB by clicking the
<v-icon small color="pink">mdi-close</v-icon> button.
<v-divider></v-divider>
</v-card-text>

<v-divider></v-divider>

<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="primary" text @click="dialog = false">Close</v-btn>
Expand Down
19 changes: 5 additions & 14 deletions frontend/components/input/genericInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
<Draggable
v-model="item.value"
class="layout row wrap"
:disabled="mode === 'view'"
:disabled="item.readonly"
>
<v-flex
v-for="(imageUrl, imageIndex) in item.value"
:key="imageIndex"
:class="'xs3'"
>
<v-card flat>
<v-system-bar v-if="mode !== 'view'" lights-out>
<v-system-bar v-if="!item.readonly" lights-out>
<v-icon @click="void 0">mdi-arrow-all</v-icon>
<v-spacer></v-spacer>
<v-btn icon @click.native="removeFileByIndex(item, imageIndex)">
Expand Down Expand Up @@ -76,7 +76,7 @@
></v-img>
<v-icon v-else>mdi-file-image</v-icon>
<v-file-input
v-if="!item.readonly && mode !== 'view'"
v-if="!item.readonly"
v-model="item.input"
:append-icon="item.value ? 'mdi-close' : null"
:clearable="false"
Expand Down Expand Up @@ -120,7 +120,7 @@
<v-icon v-else>mdi-account</v-icon></v-avatar
>
<v-file-input
v-if="!item.readonly && mode !== 'view'"
v-if="!item.readonly"
v-model="item.input"
:append-icon="item.value ? 'mdi-close' : null"
:clearable="false"
Expand Down Expand Up @@ -451,20 +451,11 @@ export default {
type: Object,
required: true,
},
// must be add, edit, or view
mode: {
type: String,
required: true,
validator: (value) => {
return ['add', 'edit', 'view', 'delete', 'share'].includes(value)
},
},
},
computed: {
isReadonly() {
return this.item.readonly || this.mode === 'view'
return this.item.readonly
},
},
methods: {
Expand Down
Loading

0 comments on commit 966c9bf

Please sign in to comment.