Merge lp:~openerp-dev/openerp-web/7.0-opw-587544-cpa into lp:openerp-web/7.0

Proposed by Chirag Patel (OpenERP)
Status: Rejected
Rejected by: Christophe Matthieu (OpenERP)
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-587544-cpa
Merge into: lp:openerp-web/7.0
Diff against target: 127 lines (+99/-1)
3 files modified
addons/web/__openerp__.py (+1/-0)
addons/web/static/lib/jquery.actual/jquery.actual.js (+97/-0)
addons/web/static/lib/jquery.textext/jquery.textext.js (+1/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-587544-cpa
Reviewer Review Type Date Requested Status
Christophe Matthieu (OpenERP) (community) Disapprove
Review via email: mp+154931@code.launchpad.net

Description of the change

Hello,

M2m field wrong height count when field in nonactive notebook page at load time.

Demo: Sales > Sales orders
1) Create new sales order
2) Open notebook page "Other Information"

Observed: "Categories" field overlappping "Source Document".

m2m field in second page and page is nonactive so field is hidden.
jQuery always gives 0 when we try to find height of hidden element.
so find the actual height of element actual.js added.

Thanks

To post a comment you must log in.
Revision history for this message
Christophe Matthieu (OpenERP) (chm-openerp) wrote :

Hi,
No need lib.
Already fixed with "min-height: 22px"
Thanks

review: Disapprove

Unmerged revisions

3855. By Chirag Patel (OpenERP)

[FIX] Fixed m2m field wrong height count when field in nonactive notebook page.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'addons/web/__openerp__.py'
2--- addons/web/__openerp__.py 2013-03-20 14:36:52 +0000
3+++ addons/web/__openerp__.py 2013-03-22 12:16:24 +0000
4@@ -58,6 +58,7 @@
5 "static/src/js/view_list.js",
6 "static/src/js/view_list_editable.js",
7 "static/src/js/view_tree.js",
8+ "static/lib/jquery.actual/jquery.actual.js",
9 ],
10 'css' : [
11 "static/lib/jquery.ui.bootstrap/css/custom-theme/jquery-ui-1.9.0.custom.css",
12
13=== added directory 'addons/web/static/lib/jquery.actual'
14=== added file 'addons/web/static/lib/jquery.actual/jquery.actual.js'
15--- addons/web/static/lib/jquery.actual/jquery.actual.js 1970-01-01 00:00:00 +0000
16+++ addons/web/static/lib/jquery.actual/jquery.actual.js 2013-03-22 12:16:24 +0000
17@@ -0,0 +1,97 @@
18+/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
19+* Licensed under the MIT License (LICENSE.txt).
20+*
21+* Version: 1.0.14
22+*
23+* Requires: jQuery 1.2.3 ~ 1.9.0
24+*/
25+;( function ( $ ){
26+ $.fn.extend({
27+ actual : function ( method, options ){
28+ // check if the jQuery method exist
29+ if( !this[ method ]){
30+ throw '$.actual => The jQuery method "' + method + '" you called does not exist';
31+ }
32+
33+ var defaults = {
34+ absolute : false,
35+ clone : false,
36+ includeMargin : false
37+ };
38+
39+ var configs = $.extend( defaults, options );
40+
41+ var $target = this.eq( 0 );
42+ var fix, restore;
43+
44+ if( configs.clone === true ){
45+ fix = function (){
46+ var style = 'position: absolute !important; top: -1000 !important; ';
47+
48+ // this is useful with css3pie
49+ $target = $target.
50+ clone().
51+ attr( 'style', style ).
52+ appendTo( 'body' );
53+ };
54+
55+ restore = function (){
56+ // remove DOM element after getting the width
57+ $target.remove();
58+ };
59+ }else{
60+ var tmp = [];
61+ var style = '';
62+ var $hidden;
63+
64+ fix = function (){
65+ // get all hidden parents
66+ if ($.fn.jquery >= "1.8.0")
67+ $hidden = $target.parents().addBack().filter( ':hidden' );
68+ else
69+ $hidden = $target.parents().andSelf().filter( ':hidden' );
70+
71+ style += 'visibility: hidden !important; display: block !important; ';
72+
73+ if( configs.absolute === true ) style += 'position: absolute !important; ';
74+
75+ // save the origin style props
76+ // set the hidden el css to be got the actual value later
77+ $hidden.each( function (){
78+ var $this = $( this );
79+
80+ // Save original style. If no style was set, attr() returns undefined
81+ tmp.push( $this.attr( 'style' ));
82+ $this.attr( 'style', style );
83+ });
84+ };
85+
86+ restore = function (){
87+ // restore origin style values
88+ $hidden.each( function ( i ){
89+ var $this = $( this );
90+ var _tmp = tmp[ i ];
91+
92+ if( _tmp === undefined ){
93+ $this.removeAttr( 'style' );
94+ }else{
95+ $this.attr( 'style', _tmp );
96+ }
97+ });
98+ };
99+ }
100+
101+ fix();
102+ // get the actual value with user specific methed
103+ // it can be 'width', 'height', 'outerWidth', 'innerWidth'... etc
104+ // configs.includeMargin only works for 'outerWidth' and 'outerHeight'
105+ var actual = /(outer)/g.test( method ) ?
106+ $target[ method ]( configs.includeMargin ) :
107+ $target[ method ]();
108+
109+ restore();
110+ // IMPORTANT, this plugin only return the value of the first element
111+ return actual;
112+ }
113+ });
114+})( jQuery );
115
116=== modified file 'addons/web/static/lib/jquery.textext/jquery.textext.js'
117--- addons/web/static/lib/jquery.textext/jquery.textext.js 2012-06-27 14:47:31 +0000
118+++ addons/web/static/lib/jquery.textext/jquery.textext.js 2013-03-22 12:16:24 +0000
119@@ -976,7 +976,7 @@
120
121 self.trigger(EVENT_PRE_INVALIDATE);
122
123- height = input.outerHeight();
124+ height = input.actual('outerHeight');
125
126 input.width(width);
127 wrap.width(width).height(height);