2018-01-30 12:03:04 +00:00
|
|
|
const BaseList = require('frappejs/client/view/list');
|
|
|
|
const BaseForm = require('frappejs/client/view/form');
|
|
|
|
|
|
|
|
module.exports = {
|
2018-02-13 10:42:44 +00:00
|
|
|
getFormClass(doctype) {
|
2018-01-30 12:03:04 +00:00
|
|
|
return this.get_view_class(doctype, 'Form', BaseForm);
|
|
|
|
},
|
2018-02-08 09:38:47 +00:00
|
|
|
getList_class(doctype) {
|
2018-01-30 12:03:04 +00:00
|
|
|
return this.get_view_class(doctype, 'List', BaseList);
|
|
|
|
},
|
|
|
|
get_view_class(doctype, class_name, default_class) {
|
|
|
|
let client_module = this.get_client_module(doctype);
|
|
|
|
if (client_module && client_module[class_name]) {
|
|
|
|
return client_module[class_name];
|
|
|
|
} else {
|
|
|
|
return default_class;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
get_client_module(doctype) {
|
|
|
|
return frappe.modules[`${doctype}_client`];
|
|
|
|
}
|
|
|
|
}
|