feat: set filter on Web Page Blocks
Component is not allowed as a page section, only as part of another Web Template.
This commit is contained in:
parent
dc98dba97f
commit
aba8bf28bc
1 changed files with 17 additions and 1 deletions
|
|
@ -19,6 +19,9 @@ frappe.ui.form.on('Web Page', {
|
|||
insert_code: function(frm) {
|
||||
frm.events.layout(frm);
|
||||
},
|
||||
onload: function(frm) {
|
||||
frm.trigger('set_filters_on_web_page_blocks');
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.template_path) {
|
||||
frm.set_read_only();
|
||||
|
|
@ -40,7 +43,20 @@ frappe.ui.form.on('Web Page', {
|
|||
frm.set_value('end_date', end_date);
|
||||
}
|
||||
},
|
||||
|
||||
content_type: function(frm) {
|
||||
frm.trigger('set_filters_on_web_page_blocks');
|
||||
},
|
||||
set_filters_on_web_page_blocks: function(frm) {
|
||||
if (frm.doc.content_type === 'Page Builder') {
|
||||
frm.set_query('web_template', 'page_blocks', function() {
|
||||
return {
|
||||
"filters": {
|
||||
"type": ['!=', 'Component']
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
set_meta_tags(frm) {
|
||||
frappe.utils.set_meta_tag(frm.doc.route);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue