Merge pull request #1003 from neilLasrado/v5.0

fix in image view
This commit is contained in:
Nabin Hait 2015-02-18 20:40:12 +05:30
commit 157cee55de
2 changed files with 6 additions and 3 deletions

View file

@ -471,7 +471,7 @@ def delete_doc_if_exists(doctype, name):
def reload_doctype(doctype):
"""Reload DocType from model (`[module]/[doctype]/[name]/[name].json`) files."""
reload_doc(db.get_value("DocType", doctype, "module"), "doctype", doctype)
reload_doc(db.get_value("DocType", doctype, "module"), "doctype", scrub(doctype))
def reload_doc(module, dt=None, dn=None, force=False):
"""Reload Document from model (`[module]/[doctype]/[name]/[name].json`) files.

View file

@ -127,10 +127,13 @@ frappe.ui.form.ControlImage = frappe.ui.form.Control.extend({
.css({"max-width": "600px", "margin": "0px"});
this.$body = $("<div></div>").appendTo(this.$wrapper)
.css({"margin-bottom": "10px", "max-width": "100%"})
this.$wrapper.on("refresh", function() {
me.$body.empty();
if(me.df.options && me.frm.doc[me.df.options]) {
me.$img = $("<img src='"+me.frm.doc[me.df.options]+"' style='max-width: 100%;'>")
var doc = frappe.model.get_doc(me.doctype, me.docname);
if(me.df.options && doc[me.df.options]) {
me.$img = $("<img src='"+doc[me.df.options]+"' style='max-width: 100%;'>")
.appendTo(me.$body);
} else {
me.$buffer = $("<div class='missing-image'><i class='octicon octicon-circle-slash'></i></div>")