Allow records to be opened in edit mode
This commit is contained in:
parent
144eb912fb
commit
262a70015b
@ -321,7 +321,7 @@
|
||||
:key="`${index}${item.r.recordID}`"
|
||||
:class="{ 'pointer': !(options.editable && editing), }"
|
||||
:variant="inlineEditing && item.r.deletedAt ? 'warning' : ''"
|
||||
@click="handleRowClicked(item)"
|
||||
@click="handleRowClick(item)"
|
||||
>
|
||||
<b-td
|
||||
v-if="options.draggable && inlineEditing"
|
||||
@ -435,6 +435,7 @@
|
||||
:icon="['fas', 'ellipsis-v']"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<template v-if="inlineEditing">
|
||||
<b-dropdown-item
|
||||
v-if="isCloneRecordActionVisible"
|
||||
@ -1462,7 +1463,7 @@ export default {
|
||||
this.processing = false
|
||||
},
|
||||
|
||||
handleRowClicked ({ r: { recordID } }) {
|
||||
handleRowClick ({ r: { recordID } }) {
|
||||
if ((this.options.editable && this.editing) || (!this.recordPageID && !this.options.rowViewUrl)) {
|
||||
return
|
||||
}
|
||||
@ -1476,9 +1477,19 @@ export default {
|
||||
})
|
||||
}
|
||||
|
||||
if (this.options.recordDisplayOption === 'modal' || this.inModal) {
|
||||
this.$root.$emit('show-record-modal', {
|
||||
recordID,
|
||||
recordPageID: this.recordPageID,
|
||||
edit: this.options.openRecordInEditMode,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const pageID = this.recordPageID
|
||||
const name = this.options.openRecordInEditMode ? this.options.rowEditUrl || 'page.record.edit' : this.options.rowViewUrl || 'page.record'
|
||||
const route = {
|
||||
name: this.options.rowViewUrl || 'page.record',
|
||||
name,
|
||||
params: {
|
||||
pageID,
|
||||
recordID,
|
||||
@ -1486,12 +1497,7 @@ export default {
|
||||
query: null,
|
||||
}
|
||||
|
||||
if (this.options.recordDisplayOption === 'modal' || this.inModal) {
|
||||
this.$root.$emit('show-record-modal', {
|
||||
recordID,
|
||||
recordPageID: this.recordPageID,
|
||||
})
|
||||
} else if (this.options.recordDisplayOption === 'newTab') {
|
||||
if (this.options.recordDisplayOption === 'newTab') {
|
||||
window.open(this.$router.resolve(route).href)
|
||||
} else {
|
||||
this.$router.push(route)
|
||||
|
||||
@ -619,6 +619,22 @@
|
||||
<b-col
|
||||
cols="12"
|
||||
lg="6"
|
||||
>
|
||||
<b-form-group
|
||||
:label="$t('recordList.record.editMode')"
|
||||
label-class="text-primary"
|
||||
>
|
||||
<c-input-checkbox
|
||||
v-model="options.openRecordInEditMode"
|
||||
switch
|
||||
:labels="checkboxLabel"
|
||||
/>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
|
||||
<b-col
|
||||
cols="12"
|
||||
md="6"
|
||||
>
|
||||
<b-form-group
|
||||
:label="$t('recordList.selectable')"
|
||||
|
||||
@ -67,6 +67,7 @@ export interface Options {
|
||||
inlineRecordEditEnabled: boolean;
|
||||
filterPresets: FilterPreset[];
|
||||
showRecordPerPageOption: boolean;
|
||||
openRecordInEditMode: boolean;
|
||||
}
|
||||
|
||||
const defaults: Readonly<Options> = Object.freeze({
|
||||
@ -120,6 +121,7 @@ const defaults: Readonly<Options> = Object.freeze({
|
||||
inlineRecordEditEnabled: false,
|
||||
filterPresets: [],
|
||||
showRecordPerPageOption: false,
|
||||
openRecordInEditMode: false,
|
||||
})
|
||||
|
||||
export class PageBlockRecordList extends PageBlock {
|
||||
@ -183,6 +185,7 @@ export class PageBlockRecordList extends PageBlock {
|
||||
'bulkRecordEditEnabled',
|
||||
'inlineRecordEditEnabled',
|
||||
'showRecordPerPageOption',
|
||||
'openRecordInEditMode',
|
||||
)
|
||||
|
||||
if (o.selectionButtons) {
|
||||
|
||||
@ -465,6 +465,7 @@ recordList:
|
||||
withPresortedRecords: with presorted ({{0}}) record
|
||||
record:
|
||||
draggable: Can drag & drop records to order them
|
||||
editMode: Users will be able to open record in edit mode when a row is clicked
|
||||
fullPageNavigation: Full page navigation
|
||||
hideAddButton: Users will be able to add new records
|
||||
hideImportButton: Users will be able to import records
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user