2
0
mirror of https://github.com/frappe/books.git synced 2024-11-14 01:14:03 +00:00
books/client/desk/listpage.js

29 lines
811 B
JavaScript
Raw Normal View History

2018-02-08 09:38:47 +00:00
const frappe = require('frappejs');
2018-01-30 12:03:04 +00:00
const Page = require('frappejs/client/view/page');
const view = require('frappejs/client/view');
2018-02-08 09:38:47 +00:00
module.exports = class ListPage extends Page {
2018-02-19 16:41:10 +00:00
constructor(doctype) {
let meta = frappe.getMeta(doctype);
2018-02-14 16:44:50 +00:00
2018-02-19 16:41:10 +00:00
// if center column is present, list does not have its route
const hasRoute = frappe.desk.center ? false : true;
2018-02-14 16:44:50 +00:00
2018-02-19 16:41:10 +00:00
super({
title: frappe._("List: {0}", meta.name),
parent: hasRoute ? frappe.desk.body : frappe.desk.center,
hasRoute: hasRoute
});
2018-02-14 16:44:50 +00:00
2018-02-20 06:39:41 +00:00
this.list = new (view.getListClass(doctype))({
2018-02-19 16:41:10 +00:00
doctype: doctype,
parent: this.body,
page: this
});
2018-02-14 16:44:50 +00:00
2018-02-19 16:41:10 +00:00
this.on('show', async () => {
await this.list.run();
});
}
2018-01-30 12:03:04 +00:00
}