Merge lp:~openerp-dev/openerp-web/7.0-bug-1097757-ggh into lp:openerp-web/7.0

Proposed by Farid Ghanchi
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-bug-1097757-ggh
Merge into: lp:openerp-web/7.0
Diff against target: 34 lines (+10/-2)
2 files modified
addons/web/static/src/js/chrome.js (+9/-1)
addons/web/static/src/xml/base.xml (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-bug-1097757-ggh
Reviewer Review Type Date Requested Status
Farid Ghanchi (community) Needs Resubmitting
Xavier (Open ERP) (community) Needs Fixing
Review via email: mp+145306@code.launchpad.net

Description of the change

Hello,

I had fixed the issue of Deactivate Developer mode in 7.0.
About OpenERP >> Activate the Developer mode and Deactivate the Developer mode.

Thanks

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

This is broken, for instance the first test will match any "debug" anywhere in the url, if somebody creates a page served through a controller on /debug or the web client is embedded in a page whose URL contains the word "debug", it'll match and this bit will believe it is in debug mode somehow.

Considering we are already using jquery-bbq for query parameters manipulation, I would suggest learning the library and using it for this case as well, instead of doing the same thing by hand incorrectly.

review: Needs Fixing
3732. By Farid Ghanchi

[FIx]Fixed the issue of Deactivate Developer mode with BBQ lib

3733. By Farid Ghanchi

[Fix]match debug only querystring(?#) in url

Revision history for this message
Farid Ghanchi (gfarid) wrote :

Hello sir,
I have improved code as you suggest
And now debug is match in url but not whole url only query_string area, Its match in only window.location.href means before # code.
Also change code for deactivate mode to remove debug in url using jquery-bbq

Thanks

review: Needs Resubmitting
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

1. Why are you still doing a match on the querystring instead of using $.deparam.querystring, which returns a parsed and structured object?
2. The current JS code "untranslates" terms
3. Why is there a reference to "window.location.hash" to deactivate the developer mode? Also why do you check for the devmode status based on the label of a button instead of checking the actual devmode status (which you're supposed to have already done once above, so you could just memoize that)

review: Needs Fixing
3734. By Farid Ghanchi

[Merge] with trunk

3735. By Farid Ghanchi

[Fix] Used to deparam.querystring in deactivat devmode

Revision history for this message
Farid Ghanchi (gfarid) wrote :

Hello,

Improved code,
Used deparam.querystring() in directly get debug so we remove match code,
and set translated tearms.
And I had used windows.location.hash because its get hash string and debug is set on that(before #) so we used ,'#'.

Thanks...
Farid Ghanchi

review: Needs Resubmitting

Unmerged revisions

3735. By Farid Ghanchi

[Fix] Used to deparam.querystring in deactivat devmode

3734. By Farid Ghanchi

[Merge] with trunk

3733. By Farid Ghanchi

[Fix]match debug only querystring(?#) in url

3732. By Farid Ghanchi

[FIx]Fixed the issue of Deactivate Developer mode with BBQ lib

3731. By Farid Ghanchi

[Fix ] FIxed the issue of Developer mode Deactivate

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/static/src/js/chrome.js'
2--- addons/web/static/src/js/chrome.js 2013-02-13 14:39:53 +0000
3+++ addons/web/static/src/js/chrome.js 2013-02-15 06:16:31 +0000
4@@ -1067,9 +1067,17 @@
5 var self = this;
6 self.rpc("/web/webclient/version_info", {}).done(function(res) {
7 var $help = $(QWeb.render("UserMenu.about", {version_info: res}));
8+ if ($.deparam.querystring().debug == undefined){
9+ $help.find('span.oe_debug_activate').text(_t("Activate"));
10+ } else {
11+ $help.find('span.oe_debug_activate').text(_t("Deactivate"));
12+ }
13 $help.find('a.oe_activate_debug_mode').click(function (e) {
14 e.preventDefault();
15- window.location = $.param.querystring( window.location.href, 'debug');
16+ if ($help.find('span.oe_debug_activate').text() == _t("Activate")) {
17+ window.location = $.param.querystring( window.location.href, 'debug');
18+ } else {
19+ window.location = $.param.querystring( window.location.hash, '#');}
20 });
21 instance.web.dialog($help, {autoOpen: true,
22 modal: true, width: 507, height: 290, resizable: false, title: _t("About")});
23
24=== modified file 'addons/web/static/src/xml/base.xml'
25--- addons/web/static/src/xml/base.xml 2013-02-13 15:21:58 +0000
26+++ addons/web/static/src/xml/base.xml 2013-02-15 06:16:31 +0000
27@@ -413,7 +413,7 @@
28 <t t-name="UserMenu.about">
29
30 <div class="oe_about">
31- <a class="oe_activate_debug_mode oe_right" href="?debug" style="background-color: white; padding:2px 6px; border-radius: 10px;">Activate the developer mode</a>
32+ <a class="oe_activate_debug_mode oe_right" href="?debug" style="background-color: white; padding:2px 6px; border-radius: 10px;"><span class="oe_debug_activate">Activate</span> the developer mode</a>
33 <img class="oe_logo" src="/web/static/src/img/logo2.png"/>
34 <h3>Version <t t-esc="version_info.server_version"/></h3>
35