3
0

Fix adding new record from related record list not opening in edit mode

This commit is contained in:
Jože Fortun
2024-06-01 17:04:57 +02:00
parent 8d63ed4511
commit 1fccfa75a1
2 changed files with 25 additions and 3 deletions

View File

@@ -475,7 +475,7 @@
>
<b-dropdown-item
v-if="isViewRecordActionVisible(item.r)"
:to="{ name: options.rowViewUrl || 'page.record', params: { pageID: recordPageID, recordID: item.r.recordID }, query: null }"
@click="handleViewRecordAction(item.r.recordID)"
>
<font-awesome-icon
:icon="['far', 'file-alt']"
@@ -1989,12 +1989,31 @@ export default {
recordID: NoID,
recordPageID: this.recordPageID,
refRecord,
edit: true,
})
} else {
this.$router.push({
name: this.options.rowCreateUrl || 'page.record.create',
params: { pageID, refRecord },
query: null,
edit: true,
})
}
},
handleViewRecordAction (recordID) {
if (this.inModal) {
this.$root.$emit('show-record-modal', {
recordID: recordID,
recordPageID: this.recordPageID,
edit: false,
})
} else {
this.$router.push({
name: this.options.rowViewUrl || 'page.record',
params: { pageID: this.recordPageID, recordID },
query: null,
edit: false,
})
}
},
@@ -2011,6 +2030,7 @@ export default {
name: this.options.rowEditUrl || 'page.record.edit',
params: { pageID: this.recordPageID, recordID },
query: null,
edit: true,
})
}
},
@@ -2028,9 +2048,11 @@ export default {
name: this.options.rowCreateUrl || 'page.record.create',
params: { pageID: this.recordPageID, values },
query: null,
edit: true,
})
}
},
},
}
</script>

View File

@@ -40,7 +40,7 @@
</template>
<script>
import { compose } from '@cortezaproject/corteza-js'
import { NoID, compose } from '@cortezaproject/corteza-js'
import { mapGetters, mapActions } from 'vuex'
import record from 'corteza-webapp-compose/src/mixins/record'
import ViewRecord from 'corteza-webapp-compose/src/views/Public/Pages/Records/View'
@@ -153,7 +153,7 @@ export default {
this.recordID = recordID
this.values = values
this.refRecord = refRecord
this.edit = edit
this.edit = edit || !recordID || recordID === NoID
this.loadModal({ recordID, recordPageID })