fix: Remove unnecessary code
- Extra spacing is only applied to templates of type Section - should be able to call web_block without values - default type should be Section - set_query can be set once
This commit is contained in:
parent
5d3178ed19
commit
e90faf76b5
3 changed files with 13 additions and 20 deletions
|
|
@ -193,7 +193,7 @@ def inspect(var, render=True):
|
|||
return get_jenv().from_string(html).render(context)
|
||||
|
||||
|
||||
def web_block(template, values, **kwargs):
|
||||
def web_block(template, values=None, **kwargs):
|
||||
options = {"template": template, "values": values}
|
||||
options.update(kwargs)
|
||||
return web_blocks([options])
|
||||
|
|
@ -212,9 +212,9 @@ def web_blocks(blocks):
|
|||
'doctype': 'Web Page Block',
|
||||
'web_template': block['template'],
|
||||
'web_template_values': block.get('values', {}),
|
||||
'add_top_padding': 0,
|
||||
'add_bottom_padding': 0,
|
||||
'add_container': 0,
|
||||
'add_top_padding': 1,
|
||||
'add_bottom_padding': 1,
|
||||
'add_container': 1,
|
||||
'hide_block': 0,
|
||||
'css_class': ''
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,13 @@ frappe.ui.form.on('Web Page', {
|
|||
frm.events.layout(frm);
|
||||
},
|
||||
onload: function(frm) {
|
||||
frm.trigger('set_filters_on_web_page_blocks');
|
||||
frm.set_query('web_template', 'page_blocks', function() {
|
||||
return {
|
||||
filters: {
|
||||
"type": 'Section'
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
refresh: function(frm) {
|
||||
if (frm.doc.template_path) {
|
||||
|
|
@ -43,20 +49,6 @@ 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
"label": "Standard"
|
||||
},
|
||||
{
|
||||
"default": "Section",
|
||||
"fieldname": "type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
|
|
@ -58,7 +59,7 @@
|
|||
"link_fieldname": "web_template"
|
||||
}
|
||||
],
|
||||
"modified": "2020-10-19 14:44:16.694730",
|
||||
"modified": "2020-10-22 17:36:45.042517",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Website",
|
||||
"name": "Web Template",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue