Merge lp:~therp-nl/web-addons/6.1-web_widget_classes into lp:~webaddons-core-editors/web-addons/6.1

Proposed by Holger Brunn (Therp)
Status: Merged
Merged at revision: 24
Proposed branch: lp:~therp-nl/web-addons/6.1-web_widget_classes
Merge into: lp:~webaddons-core-editors/web-addons/6.1
Diff against target: 109 lines (+88/-0)
3 files modified
web_widget_classes/__init__.py (+20/-0)
web_widget_classes/__openerp__.py (+59/-0)
web_widget_classes/static/src/xml/web_widget_classes.xml (+9/-0)
To merge this branch: bzr merge lp:~therp-nl/web-addons/6.1-web_widget_classes
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review Approve
Guewen Baconnier @ Camptocamp code review Approve
Pedro Manuel Baeza Abstain
Review via email: mp+198703@code.launchpad.net

Description of the change

This addon adds the form widget's model to the classes. This way we can do a lot of simple UI customizations with CSS.

The plan would be to do the same for the other view widgets, and provide a 7.0 version where necessary.

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Holger, I don't know too much about web client development, but I'm seeing some strange things in this MP: if it's for 6.1 version, I'm seeing on the manifest file keys values that correspond to v7 (data, auto_install, qweb, etc). Why is this?

Regards.

review: Needs Information
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Hi Pedro,

thanks for your comment. The keys are caused by my new_addon script, that writes all this stuff for me... Not really a good reason, but I'm not aware that unknown keys do any harm, are you?

But concerning the keys you mention: 'data' is used in 6.1 too and treated like 'update_xml', 'qweb' was also used in 6.1 already (otherwise, the whole plugin would be pretty pointless) and 'active' actually is an alias of 'auto_install': http://bazaar.launchpad.net/~ocb/ocb-server/6.1/view/head:/openerp/modules/module.py#L324

Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

OK, sorry for my ignorance.

I'm going to abstain and let others to make the review, due to I don't know about this area.

Regards

review: Abstain
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

s/dislpayed/displayed/

Do I understand well if I say that it will append the classes of the <table> elements of the widget a CSS class with the name of the model, example: oe_model_res_partner.

Could you give such an example in the __openerp__ manifest?

Thanks!

review: Needs Information
25. By Holger Brunn (Therp)

[FIX] typo
[IMP] add an example to description

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Thanks Guewen!

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Thanks!

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

LGTM

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'web_widget_classes'
2=== added file 'web_widget_classes/__init__.py'
3--- web_widget_classes/__init__.py 1970-01-01 00:00:00 +0000
4+++ web_widget_classes/__init__.py 2014-01-02 09:54:39 +0000
5@@ -0,0 +1,20 @@
6+# -*- coding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
11+#
12+# This program is free software: you can redistribute it and/or modify
13+# it under the terms of the GNU Affero General Public License as
14+# published by the Free Software Foundation, either version 3 of the
15+# License, or (at your option) any later version.
16+#
17+# This program is distributed in the hope that it will be useful,
18+# but WITHOUT ANY WARRANTY; without even the implied warranty of
19+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+# GNU Affero General Public License for more details.
21+#
22+# You should have received a copy of the GNU Affero General Public License
23+# along with this program. If not, see <http://www.gnu.org/licenses/>.
24+#
25+##############################################################################
26
27=== added file 'web_widget_classes/__openerp__.py'
28--- web_widget_classes/__openerp__.py 1970-01-01 00:00:00 +0000
29+++ web_widget_classes/__openerp__.py 2014-01-02 09:54:39 +0000
30@@ -0,0 +1,59 @@
31+# -*- coding: utf-8 -*-
32+##############################################################################
33+#
34+# OpenERP, Open Source Management Solution
35+# This module copyright (C) 2013 Therp BV (<http://therp.nl>).
36+#
37+# This program is free software: you can redistribute it and/or modify
38+# it under the terms of the GNU Affero General Public License as
39+# published by the Free Software Foundation, either version 3 of the
40+# License, or (at your option) any later version.
41+#
42+# This program is distributed in the hope that it will be useful,
43+# but WITHOUT ANY WARRANTY; without even the implied warranty of
44+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45+# GNU Affero General Public License for more details.
46+#
47+# You should have received a copy of the GNU Affero General Public License
48+# along with this program. If not, see <http://www.gnu.org/licenses/>.
49+#
50+##############################################################################
51+{
52+ "name" : "CSS classes for widgets",
53+ "version" : "1.0",
54+ "author" : "Therp BV",
55+ "complexity": "normal",
56+ "description": """
57+ For simple UI changes, having classes attached to widgets giving
58+ information about the model being displayed can be essential.
59+
60+ For instance, to apply some CSS to the name field in forms for tasks,
61+
62+ ::
63+
64+ .oe_model_project_task input[name='name']
65+ {
66+ //your CSS
67+ }
68+
69+ will be enough.
70+ """,
71+ "category" : "Dependency",
72+ "depends" : [
73+ 'web',
74+ ],
75+ "data" : [
76+ ],
77+ "js": [
78+ ],
79+ "css": [
80+ ],
81+ "qweb": [
82+ 'static/src/xml/web_widget_classes.xml',
83+ ],
84+ "auto_install": False,
85+ "installable": True,
86+ "external_dependencies" : {
87+ 'python' : [],
88+ },
89+}
90
91=== added directory 'web_widget_classes/static'
92=== added directory 'web_widget_classes/static/src'
93=== added directory 'web_widget_classes/static/src/img'
94=== added file 'web_widget_classes/static/src/img/icon.png'
95Binary files web_widget_classes/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and web_widget_classes/static/src/img/icon.png 2014-01-02 09:54:39 +0000 differ
96=== added directory 'web_widget_classes/static/src/xml'
97=== added file 'web_widget_classes/static/src/xml/web_widget_classes.xml'
98--- web_widget_classes/static/src/xml/web_widget_classes.xml 1970-01-01 00:00:00 +0000
99+++ web_widget_classes/static/src/xml/web_widget_classes.xml 2014-01-02 09:54:39 +0000
100@@ -0,0 +1,9 @@
101+<?xml version="1.0" encoding="UTF-8"?>
102+<templates id="template">
103+ <t t-extend="WidgetFrame">
104+ <t t-jquery="table">
105+ this.attr('t-att-class', '"' + this.attr('class') + ' oe_model_" + (widget.view.dataset.model.replace(new RegExp("\\\\.","g"), "_"))');
106+ this.attr('class', null);
107+ </t>
108+ </t>
109+</templates>

Subscribers

People subscribed via source and target branches