website_settings: added button to generate html banner

This commit is contained in:
Rushabh Mehta 2013-03-13 16:30:10 +05:30
parent 4f20f693c4
commit d84f299c40
2 changed files with 26 additions and 2 deletions

View File

@ -41,4 +41,14 @@ $.extend(cur_frm.cscript, {
this.fieldobj.refresh_options(get_parent_options('top_bar_items'));
});
}
});
});
cur_frm.cscript.set_banner_from_image = function(doc) {
if(!doc.banner_image) {
msgprint(wn._("Select a Banner Image first."));
}
var src = doc.banner_image;
if(src.indexOf("/")==-1) src = "files/" + src;
cur_frm.set_value("banner_html", "<a href='/'><img src='"+ src
+"'></a>");
}

View File

@ -2,7 +2,7 @@
{
"creation": "2013-03-07 11:55:11",
"docstatus": 0,
"modified": "2013-03-12 11:17:11",
"modified": "2013-03-13 16:25:22",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -78,6 +78,20 @@
"fieldtype": "Section Break",
"label": "Banner"
},
{
"description": "Select an image of approx width 150px with a transparent background for best results.",
"doctype": "DocField",
"fieldname": "banner_image",
"fieldtype": "Select",
"label": "Banner Image",
"options": "attach_files:"
},
{
"doctype": "DocField",
"fieldname": "set_banner_from_image",
"fieldtype": "Button",
"label": "Set Banner from Image"
},
{
"description": "Banner is above the Top Menu Bar.",
"doctype": "DocField",