2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00
books/client/desk/listpage.js
2018-02-19 22:11:10 +05:30

29 lines
810 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.geListClass(doctype))({
doctype: doctype,
parent: this.body,
page: this
});
this.on('show', async () => {
await this.list.run();
});
}
}