[IMP] Improved code.
bzr revid: tpa@tinyerp.com-20120418092254-2htqligvh8ov0qkr
This commit is contained in:
parent
3ad8dad36d
commit
aca7ed80a5
|
@ -148,9 +148,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
* @returns {String} CSS color declaration
|
* @returns {String} CSS color declaration
|
||||||
*/
|
*/
|
||||||
color_for: function (record) {
|
color_for: function (record) {
|
||||||
var style= '';
|
var style= '';
|
||||||
|
|
||||||
var context = _.extend({}, record.attributes, {
|
var context = _.extend({}, record.attributes, {
|
||||||
uid: this.session.uid,
|
uid: this.session.uid,
|
||||||
current_date: new Date().toString('yyyy-MM-dd')
|
current_date: new Date().toString('yyyy-MM-dd')
|
||||||
// TODO: time, datetime, relativedelta
|
// TODO: time, datetime, relativedelta
|
||||||
|
@ -162,9 +162,17 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
font = pair[0],
|
font = pair[0],
|
||||||
expression = pair[1];
|
expression = pair[1];
|
||||||
if (py.evaluate(expression, context).toJSON()) {
|
if (py.evaluate(expression, context).toJSON()) {
|
||||||
if (font == 'bold'){style = 'font-weight: bold;';}
|
switch(font) {
|
||||||
if (font == 'italic'){style = 'font-style: italic;';}
|
case 'bold':
|
||||||
if (font == 'underline'){style = 'text-decoration: underline;';}
|
style += 'font-weight: bold;';
|
||||||
|
break;
|
||||||
|
case 'italic':
|
||||||
|
style += 'font-style: italic;';
|
||||||
|
break;
|
||||||
|
case 'underline':
|
||||||
|
style += 'text-decoration: underline;';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,8 +183,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
|
||||||
color = pair[0],
|
color = pair[0],
|
||||||
expression = pair[1];
|
expression = pair[1];
|
||||||
if (py.evaluate(expression, context).toJSON()) {
|
if (py.evaluate(expression, context).toJSON()) {
|
||||||
style += 'color: ' + color + ';'
|
return style += 'color: ' + color + ';';
|
||||||
return style;
|
|
||||||
}
|
}
|
||||||
// TODO: handle evaluation errors
|
// TODO: handle evaluation errors
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue