Merge pull request #583 from rmehta/develop

Style fixes and other stuff
This commit is contained in:
Anand Doshi 2014-06-05 15:11:55 +05:30
commit 1c3f931f61
7 changed files with 23 additions and 14 deletions

View file

@ -638,6 +638,11 @@ def set_filters(jenv):
def get_template(path):
return get_jenv().get_template(path)
def render_template(template, context):
from jinja2 import Template
template = Template(template)
return template.render(**context)
def get_website_route(doctype, name):
return db.get_value("Website Route", {"ref_doctype": doctype, "docname": name})

View file

@ -72,8 +72,8 @@ def post(txt, contact, parenttype=None, notify=False, subject=None):
if notify and cint(notify):
if contact==frappe.session.user:
_notify([user.name for user in frappe.get_list("User",
{"user_type":"System User"}) \
if user.name not in ("Guest", "Administrator")], txt, subject)
{"user_type":"System User", "enabled": 1}) \
if user.name not in ("Guest", "Administrator")], txt)
else:
_notify(contact, txt, subject)
@ -83,7 +83,7 @@ def delete(arg=None):
frappe.form_dict['name']);
def _notify(contact, txt, subject=None):
from frappe.utils import cstr, get_fullname, get_url
from frappe.utils import get_fullname, get_url
try:
if not isinstance(contact, list):
@ -98,5 +98,5 @@ def _notify(contact, txt, subject=None):
"link": get_url()
}),
bulk=True)
except frappe.OutgoingEmailError, e:
except frappe.OutgoingEmailError:
pass

View file

@ -33,6 +33,8 @@ class BaseDocument(object):
for key, value in d.iteritems():
self.set(key, value)
return self
def update_if_missing(self, d):
if isinstance(d, BaseDocument):
d = d.get_valid_dict()
@ -264,7 +266,10 @@ class BaseDocument(object):
frappe.throw(_("Options not set for link field {0}").format(df.fieldname))
docname = self.get(df.fieldname)
if docname and not frappe.db.get_value(doctype, docname):
if docname:
value = frappe.db.get_value(doctype, docname)
setattr(self, df.fieldname, value)
if docname and not value:
invalid_links.append((df.fieldname, docname, get_msg(df, docname)))
return invalid_links

View file

@ -17,14 +17,11 @@
.appframe-footer {
border-top: 1px solid #ddd;
background-color: rgba(255,255,255,0.9);
background-color: rgba(255, 255, 255, 0.9);
}
.appframe-titlebar, .appframe-iconbar {
background-color: rgba(255,255,255,0.7);
/*background: url(/assets/frappe/images/ui/sos.png) repeat;*/
/*-webkit-box-shadow: inset 0 0 7px rgba(0, 0, 0, .07);
box-shadow: inset 0 0 7px rgba(0, 0, 0, .07);*/
.appframe-titlebar, .appframe-iconbar, .appframe-form {
background-color: rgba(255, 255, 255, 0.7);
}
.appframe-iconbar {

View file

@ -57,12 +57,13 @@ frappe.form.formatters = {
},
Text: function(value) {
if(value) {
var tags = ["<p[^>]>", "<div[^>]>", "<br[^>]>"];
var tags = ["<p", "<div", "<br"];
var match = false;
for(var i=0; i<tags.length; i++) {
if(value.match(tags[i])) {
match = true;
break;
}
}

View file

@ -118,7 +118,7 @@ frappe.views.ReportView = frappe.ui.Listing.extend({
var columns = [['name', this.doctype],];
$.each(frappe.meta.docfield_list[this.doctype], function(i, df) {
if((df.in_filter || df.in_list_view) && df.fieldname!='naming_series'
&& !in_list(frappe.model.no_value_type, df.fieldname)) {
&& !in_list(frappe.model.no_value_type, df.fieldtype)) {
columns.push([df.fieldname, df.parent]);
}
});

View file

@ -297,11 +297,12 @@ $.extend(_p, {
},
add_span: function(html) {
var tags = ["<span[^>]>", "<p[^>]>", "<div[^>]>", "<br[^>]>", "<table[^>]>"];
var tags = ["<span", "<p", "<div", "<br", "<table"];
var match = false;
for(var i=0; i<tags.length; i++) {
if(html.match(tags[i])) {
match = true;
break;
}
}