mirror of
https://github.com/frappe/books.git
synced 2024-12-24 11:55:46 +00:00
29 lines
811 B
JavaScript
29 lines
811 B
JavaScript
const frappe = require('frappejs');
|
|
const Page = require('frappejs/client/view/page');
|
|
const view = require('frappejs/client/view');
|
|
|
|
module.exports = class ListPage extends Page {
|
|
constructor(doctype) {
|
|
let meta = frappe.getMeta(doctype);
|
|
|
|
// if center column is present, list does not have its route
|
|
const hasRoute = frappe.desk.center ? false : true;
|
|
|
|
super({
|
|
title: frappe._("List: {0}", meta.name),
|
|
parent: hasRoute ? frappe.desk.body : frappe.desk.center,
|
|
hasRoute: hasRoute
|
|
});
|
|
|
|
this.list = new (view.getListClass(doctype))({
|
|
doctype: doctype,
|
|
parent: this.body,
|
|
page: this
|
|
});
|
|
|
|
this.on('show', async () => {
|
|
await this.list.run();
|
|
});
|
|
}
|
|
}
|