2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/client/desk/listpage.js
2018-02-20 12:09:41 +05:30

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();
});
}
}