2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00
books/client/desk/listpage.js

29 lines
689 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-01-30 12:03:04 +00:00
constructor(doctype) {
let meta = frappe.getMeta(doctype);
2018-02-14 16:44:50 +00:00
// 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
});
2018-02-08 09:38:47 +00:00
this.list = new (view.getList_class(doctype))({
2018-01-30 12:03:04 +00:00
doctype: doctype,
2018-02-08 09:38:47 +00:00
parent: this.body,
page: this
2018-01-30 12:03:04 +00:00
});
2018-02-14 16:44:50 +00:00
2018-01-30 13:25:48 +00:00
this.on('show', async () => {
await this.list.run();
2018-01-30 12:03:04 +00:00
});
}
}