Turkesh Patel (openERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-social-list-tpa into lp:openerp-web.
Requested reviews:
Xavier (Open ERP) (xmo)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-social-list-tpa/+merge/102475
Hello,
Improved as per your suggestion.
Thanks.
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-social-list-tpa/+merge/102475
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-social-list-tpa.
=== modified file 'addons/web/static/src/js/view_editor.js'
--- addons/web/static/src/js/view_editor.js 2012-04-17 12:09:49 +0000
+++ addons/web/static/src/js/view_editor.js 2012-04-18 09:56:20 +0000
@@ -873,7 +873,8 @@
'widget' : {'name':'widget', 'string': 'widget', 'type': 'selection'},
'colors' : {'name':'colors', 'string': 'Colors', 'type': 'char'},
'editable' : {'name':'editable', 'string': 'Editable', 'type': 'selection', 'selection': [["",""],["top","Top"],["bottom", "Bottom"]]},
- 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'}
+ 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'},
+ 'fonts' : {'name':'fonts', 'string': 'fonts', 'type': 'char'},
};
var arch_val = self.get_object_by_id(this.one_object.clicked_tr_id,this.one_object['main_object'], []);
this.edit_node_dialog.$element.append('<table id="rec_table" style="width:400px" class="oe_forms"></table>');
@@ -1149,7 +1150,7 @@
'board': ['style'],
'column' : [],
'action' : ['name', 'string', 'colspan', 'groups'],
- 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows'],
+ 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows', 'fonts'],
'graph' : ['string', 'type'],
'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode']
};
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js 2012-04-17 12:15:59 +0000
+++ addons/web/static/src/js/view_list.js 2012-04-18 09:56:20 +0000
@@ -56,6 +56,7 @@
this.view_id = view_id;
this.previous_colspan = null;
this.colors = null;
+ this.fonts = null;
this.columns = [];
@@ -147,22 +148,46 @@
* @returns {String} CSS color declaration
*/
color_for: function (record) {
- if (!this.colors) { return ''; }
+ var style= '';
+
var context = _.extend({}, record.attributes, {
uid: this.session.uid,
current_date: new Date().toString('yyyy-MM-dd')
// TODO: time, datetime, relativedelta
});
+
+ if (this.fonts) {
+ for(var i=0, len=this.fonts.length; i<len; ++i) {
+ var pair = this.fonts[i],
+ font = pair[0],
+ expression = pair[1];
+ if (py.evaluate(expression, context).toJSON()) {
+ switch(font) {
+ case 'bold':
+ style += 'font-weight: bold;';
+ break;
+ case 'italic':
+ style += 'font-style: italic;';
+ break;
+ case 'underline':
+ style += 'text-decoration: underline;';
+ break;
+ }
+ }
+ }
+ }
+
+ if (!this.colors) { return style; }
for(var i=0, len=this.colors.length; i<len; ++i) {
var pair = this.colors[i],
color = pair[0],
expression = pair[1];
if (py.evaluate(expression, context).toJSON()) {
- return 'color: ' + color + ';';
+ return style += 'color: ' + color + ';';
}
// TODO: handle evaluation errors
}
- return '';
+ return style;
},
/**
* Called after loading the list view's description, sets up such things
@@ -203,6 +228,16 @@
}).value();
}
+ if (this.fields_view.arch.attrs.fonts) {
+ this.fonts = _(this.fields_view.arch.attrs.fonts.split(';')).chain().compact()
+ .map(function(font_pair) {
+ var pair = font_pair.split(':'),
+ font = pair[0],
+ expr = pair[1];
+ return [font, py.parse(py.tokenize(expr)), expr];
+ }).value();
+ }
+
this.setup_columns(this.fields_view.fields, grouped);
this.$element.html(QWeb.render(this._template, this));
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp