Merge lp:~openerp-dev/openobject-client-web/widget-per-user into lp:openobject-client-web/trunk
- widget-per-user
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 3966 |
Proposed branch: | lp:~openerp-dev/openobject-client-web/widget-per-user |
Merge into: | lp:openobject-client-web/trunk |
Diff against target: |
197 lines (+127/-5) (has conflicts) 3 files modified
addons/openerp/controllers/root.py (+43/-3) addons/openerp/controllers/templates/index.mako (+46/-1) addons/openerp/static/css/screen.css (+38/-1) Text conflict in addons/openerp/controllers/root.py Text conflict in addons/openerp/controllers/templates/index.mako |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-client-web/widget-per-user |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Xavier (Open ERP) (community) | Needs Fixing | ||
Navrang Oza (community) | Needs Fixing | ||
Antony Lesuisse (OpenERP) | Pending | ||
Review via email: mp+41128@code.launchpad.net |
Commit message
Description of the change
Widget per user.
- 3885. By Vaibhav Darji
-
[FIX] Minor changes.
Vaibhav Darji (vaibhav-openerp) wrote : | # |
Cleanup code.
For wizard action here is the change of code that work according to framework.
replace
window.
openAction(
Xavier (Open ERP) (xmo-deactivatedaccount) wrote : | # |
* Adding popup does not seem to work at all, using Firefox or Safari on the branch (no merging between trunk and branch) clicking the add button (when it's made available/visible) opens a popup with only save/save and edit/close button, can't find a way to add a widget
* Also addition should be done via addition wizard (which might have to be fixed, not sure al finished it)
* It should always be possible to add user widgets.
* Logic for displaying widgets is incorrect:
- Should only display widgets linked from `res.widget.user`, those with user_id=uid (that part is OK) *and* those with no user_id at all. Those with no user_id set can not be removed by the user (they are administrator-set and global). close_widget is not global.
- Should not fallback on reading straight from res.widget
* JS is imperfect and incorrect (if widget removal POST generates error, it still removes widgets from the interface which is not correct)
Also needs demo data for testing: when demo data,
* openerp favorites should be set as a global widget (in res.widget.user with user_id not set)
* new widget for twitter of rvalyi should be set as user widget for the administrator
* new widget for twitter of odo should be set as user widget for demo user
That way it is possible to test that per user display works correctly.
I would suggest throwing this branch away and re-doing.
- 3886. By Vaibhav Darji
-
[IMP] Check for global widget and improvements.
Vaibhav Darji (vaibhav-openerp) wrote : | # |
> * Adding popup does not seem to work at all, using Firefox or Safari on the
> branch (no merging between trunk and branch) clicking the add button (when
> it's made available/visible) opens a popup with only save/save and edit/close
> button, can't find a way to add a widget
>
Please use this server lp:~openerp/openobject-server/widget-per-user, to work wizard properly. Otherwise how the web-client will get the view!
> * Also addition should be done via addition wizard (which might have to be
> fixed, not sure al finished it)
It is performed as expected when server-branch is compatible.
>
> * It should always be possible to add user widgets.
>
> * Logic for displaying widgets is incorrect:
> - Should only display widgets linked from `res.widget.user`, those with
> user_id=uid (that part is OK) *and* those with no user_id at all. Those with
> no user_id set can not be removed by the user (they are administrator-set and
> global). close_widget is not global.
Logic is as AL explained, for Administrator `openerp favorites` is added in `res.widget.user`, so is displaying one and giving ADD and close buttons too.
And for demo user no record exist in `res.widget.user`, so displays all widgets including `openerp favorites` and does not display ADD and Close button.
> - Should not fallback on reading straight from res.widget
>
Can't understand this comment.
> * JS is imperfect and incorrect (if widget removal POST generates error, it
> still removes widgets from the interface which is not correct)
>
Commited on branch.
> Also needs demo data for testing: when demo data,
> * openerp favorites should be set as a global widget (in res.widget.user with
> user_id not set)
> * new widget for twitter of rvalyi should be set as user widget for the
> administrator
> * new widget for twitter of odo should be set as user widget for demo user
>
> That way it is possible to test that per user display works correctly.
>
> I would suggest throwing this branch away and re-doing.
Xavier (Open ERP) (xmo-deactivatedaccount) wrote : | # |
> It is performed as expected when server-branch is compatible.
OK, sorry, forgot about that one.
> And for demo user no record exist in `res.widget.user`, so displays all widgets including `openerp favorites` and does not display ADD and Close button.
No, that's not good, if the user has no widget then the user has no widget period end of the story.
Logic is the following, very simple:
1. widgets in res.widget.user with user_id is null are displayed for current user and don't have delete button
2. widgets in res.widget.user with user_id=uid are displayed for current user and have delete button
3. user can always add new widget to bar, even when he has none displayed
> Can't understand this comment.
The part about demo user (if no widget for user in res.widget.user, you just read everything in res.widget) is not good
Xavier (Open ERP) (xmo-deactivatedaccount) wrote : | # |
OK, with correct server branch it does indeed display correctly. Still, logic for displaying widgets is not right, and we need more demo data to demo & test correctly.
- 3887. By Vaibhav Darji
-
[FIX] User can add new widget.
- 3888. By Vaibhav Darji
-
[FIX] removed code by mistake.
Vaibhav Darji (vaibhav-openerp) wrote : | # |
user can always add new widget to bar.
- 3889. By Xavier (Open ERP)
-
[IMP] cleanup some code, remove redundant queries
- 3890. By Xavier (Open ERP)
-
[IMP] invert removability flag, always set it
- 3891. By Xavier (Open ERP)
-
[IMP] try to simplify widget-removal JS a bit
- 3892. By Xavier (Open ERP)
-
[IMP] Move homepage widget JS to the document's head
- 3893. By Xavier (Open ERP)
-
[IMP] use listcomp to format widgets in way useable within template
Preview Diff
1 | === modified file 'addons/openerp/controllers/root.py' |
2 | --- addons/openerp/controllers/root.py 2010-11-24 16:52:46 +0000 |
3 | +++ addons/openerp/controllers/root.py 2010-11-25 12:31:11 +0000 |
4 | @@ -131,13 +131,53 @@ |
5 | tree.tree.onselection = None |
6 | tree.tree.onheaderclick = None |
7 | tree.tree.showheaders = 0 |
8 | - else: |
9 | - # display home action |
10 | - tools = None |
11 | +<<<<<<< TREE |
12 | + else: |
13 | + # display home action |
14 | + tools = None |
15 | +======= |
16 | + else: |
17 | + # display home action |
18 | + tools = None |
19 | + |
20 | +>>>>>>> MERGE-SOURCE |
21 | widgets = rpc.RPCProxy('res.widget') |
22 | +<<<<<<< TREE |
23 | maintenance = rpc.RPCProxy('maintenance.contract').status() |
24 | return dict(parents=parents, tools=tools, maintenance=maintenance, load_content=(next and next or ''), |
25 | widgets=widgets.read(widgets.search([], 0, 0, 0, ctx), [], ctx)) |
26 | +======= |
27 | + user_widgets = rpc.RPCProxy('res.widget.user') |
28 | + widget_ids = user_widgets.search( |
29 | + ['|', ('user_id', '=', rpc.session.uid), ('user_id', '=', False)], |
30 | + 0, 0, 0, ctx) |
31 | + |
32 | + homepage_user_widgets = [ |
33 | + dict(widgets.read([wid['widget_id'][0]], [], ctx)[0], |
34 | + user_widget_id=wid['id'], |
35 | + # NULL user_id = global = non-removable |
36 | + removable=bool(wid['user_id'])) |
37 | + for wid in user_widgets.read( |
38 | + widget_ids, ['widget_id', 'user_id'], ctx) |
39 | + ] |
40 | + |
41 | + return dict(parents=parents, tools=tools, load_content=(next and next or ''), |
42 | + widgets=homepage_user_widgets) |
43 | + |
44 | + @expose('json', methods=('POST',)) |
45 | + def close_user_widget(self, widget_id): |
46 | + error = None |
47 | + try: |
48 | + rpc.RPCProxy('res.widget.user').unlink(widget_id, rpc.session.context) |
49 | + except Exception, e: |
50 | + error = e |
51 | + return dict(error=error) |
52 | + |
53 | + @expose() |
54 | + def add_user_widget(self): |
55 | + return actions.execute_window([False], 'res.widget.wizard') |
56 | + |
57 | +>>>>>>> MERGE-SOURCE |
58 | |
59 | @expose(allow_json=True) |
60 | @unsecured |
61 | |
62 | === modified file 'addons/openerp/controllers/templates/index.mako' |
63 | --- addons/openerp/controllers/templates/index.mako 2010-11-24 16:52:46 +0000 |
64 | +++ addons/openerp/controllers/templates/index.mako 2010-11-25 12:31:11 +0000 |
65 | @@ -15,9 +15,32 @@ |
66 | // Don't load doc if there is a hash-url, it takes precedence |
67 | if(DOCUMENT_TO_LOAD && !hashUrl()) { |
68 | openLink(DOCUMENT_TO_LOAD); |
69 | + return |
70 | } |
71 | + |
72 | + // Make home widgets closable |
73 | + jQuery('#user_widgets a.close').click(function() { |
74 | + var $widget = jQuery(this); |
75 | + jQuery.post( |
76 | + '/openerp/close_user_widget', |
77 | + {widget_id: $widget.attr('id')}, |
78 | + function(obj) { |
79 | + if(obj.error) { |
80 | + error_display(obj.error); |
81 | + return; |
82 | + } |
83 | + var $root = $widget.closest('.side'); |
84 | + $root.next() |
85 | + .add($root) |
86 | + .remove(); |
87 | + }, 'json'); |
88 | + }); |
89 | + // Addition of new home widgets |
90 | + jQuery('#add_user_widget').click(function() { |
91 | + window.open(this.href); |
92 | + return false; |
93 | + }); |
94 | }); |
95 | - |
96 | </script> |
97 | </%def> |
98 | |
99 | @@ -147,13 +170,35 @@ |
100 | </li> |
101 | </ul> |
102 | </div> |
103 | +<<<<<<< TREE |
104 | % endif |
105 | <div class="box-a" style="margin-top: 10px"> |
106 | +======= |
107 | + <div class="sideheader-a"> |
108 | +>>>>>>> MERGE-SOURCE |
109 | <ul class="side"> |
110 | + <li> |
111 | + <a class="button-a" href="${py.url('/openerp/add_user_widget')}" id="add_user_widget">${_("Add")}</a> |
112 | + </li> |
113 | </ul> |
114 | + <h2>${_("Widgets")}</h2> |
115 | + </div> |
116 | + <div class="box-a" id="user_widgets"> |
117 | % for widget in widgets: |
118 | +<<<<<<< TREE |
119 | <div class="sideheader-a" style="padding: 0"> |
120 | <h2>${widget['title']}</h2> |
121 | +======= |
122 | + % if widget['removable']: |
123 | + <ul class="side"> |
124 | + <li> |
125 | + <a id="${widget['user_widget_id']}" class="close">${_("Close")}</a> |
126 | + </li> |
127 | + </ul> |
128 | + % endif |
129 | + <div> |
130 | + <h3>${widget['title']}</h3> |
131 | +>>>>>>> MERGE-SOURCE |
132 | ${widget['content']|n} |
133 | </div> |
134 | % endfor |
135 | |
136 | === modified file 'addons/openerp/static/css/screen.css' |
137 | --- addons/openerp/static/css/screen.css 2010-11-25 11:11:28 +0000 |
138 | +++ addons/openerp/static/css/screen.css 2010-11-25 12:31:11 +0000 |
139 | @@ -1950,7 +1950,7 @@ |
140 | |
141 | .sideheader-a { |
142 | position: relative; |
143 | - padding-right: 21px; |
144 | + padding-right: 30px; |
145 | border-top: 1px solid #e1dede; |
146 | border-bottom: 1px solid #d2cfcf; |
147 | background: url(../images/sideheader-a-bg.png) 0 100% repeat-x; |
148 | @@ -1973,6 +1973,7 @@ |
149 | padding-left: 3px; |
150 | padding-right: 3px; |
151 | font-size: 0.9em; |
152 | + cursor: pointer; |
153 | } |
154 | |
155 | .sideheader-a h2 { |
156 | @@ -2237,6 +2238,42 @@ |
157 | .w50 { |
158 | width: 50% !important; |
159 | } |
160 | + |
161 | +div.box-a ul.side { |
162 | + float: right; |
163 | + list-style: none; |
164 | + margin: 7px 10px 0 0; |
165 | + padding: 0; |
166 | +} |
167 | + |
168 | +div.box-a ul.side li { |
169 | + display: inline; |
170 | + float: left; |
171 | + margin: 0 0 0 5px; |
172 | +} |
173 | + |
174 | +div.box-a ul.side li a { |
175 | + float: left; |
176 | + overflow: hidden; |
177 | + width: 10px; |
178 | + height: 10px; |
179 | + background: url(../images/sideicons-a.gif) no-repeat; |
180 | + text-indent: -10001px; |
181 | +} |
182 | + |
183 | +div.box-a ul.side li a.move { |
184 | + background-position: 0 0; |
185 | + cursor: move; |
186 | +} |
187 | + |
188 | +div.box-a ul.side li a.minimize { |
189 | + background-position: -10px 0; |
190 | +} |
191 | + |
192 | +div.box-a ul.side li a.close { |
193 | + background-position: -20px 0; |
194 | +} |
195 | + |
196 | /* SPECIFIC |
197 | ------------------------------------------- */ |
198 |
Hello vda,
I think wizard for new widget should be opened in popup instead of new tab or new window.
(What are you thinking XMO ?)
In committed changes, search` should be there.
line 11, `user_widget.
line 26, spaces around '='. (minor)