[ADD] Debug layout.

bzr revid: fme@openerp.com-20120320110115-1v4ypw9t06s7l9rb
This commit is contained in:
Fabien Meghazi 2012-03-20 12:01:15 +01:00
parent cf4159c7f8
commit d76e8be574
4 changed files with 61 additions and 1 deletions

View File

@ -347,3 +347,31 @@
width: 100%;
white-space: nowrap;
}
.openerp2 .oe_form_group_cell {
position: relative;
}
.openerp2 .oe_form_group_cell .oe_field_char, .openerp2 .oe_form_group_cell .oe_form_field_selection select {
width: 99%;
}
.openerp2 .oe_form_group_cell .oe_form_field_selection select {
min-width: 90px;
}
.openerp2 .oe_layout_debugging .oe_form_group {
border: 1px solid red;
}
.openerp2 .oe_layout_debugging .oe_form_group_cell {
border: 1px solid blue;
}
.openerp2 .oe_layout_debugging .oe_layout_debug_cell {
position: absolute;
color: white;
bottom: 0;
left: 0;
background: green;
}
.openerp2 .oe_layout_debugging .oe_layout_debug_cell {
display: block;
}
.openerp2 .oe_layout_debug_cell {
display: none;
}

View File

@ -340,6 +340,27 @@ $colour4: #8a89ba
.oe_form_button
width: 100%
white-space: nowrap
.oe_form_group_cell
position: relative
.oe_field_char, .oe_form_field_selection select
width: 99%
.oe_form_field_selection select
min-width: 90px
.oe_layout_debugging
.oe_form_group
border: 1px solid red
.oe_form_group_cell
border: 1px solid blue
.oe_layout_debug_cell
position: absolute
color: white
bottom: 0
left: 0
background: green
.oe_layout_debug_cell
display: block
.oe_layout_debug_cell
display: none
// }}}
.openerp

View File

@ -767,6 +767,17 @@ openerp.web.FormRenderingEngine = openerp.web.Widget.extend({
w.replace($elem);
}
});
$('<button>Debug layout</button>').appendTo(this.$element).click(this.do_toggle_layout_debugging);
},
do_toggle_layout_debugging: function() {
if (!this.$element.has('.oe_layout_debug_cell:first').length) {
this.$element.find('.oe_form_group_cell').each(function() {
var $span = $('<span class="oe_layout_debug_cell"/>').text($(this).attr('width'));
$span.prependTo($(this));
});
}
this.$element.toggleClass('oe_layout_debugging');
},
process_field: function($field, $form) {
var name = $field.attr('name'),

View File

@ -948,7 +948,7 @@
<input t-att-type="widget.password ? 'password' : 'text'"
t-att-name="widget.name"
t-att-id="widget.id_for_label"
t-attf-class="field_#{widget.type} #{_(['integer', 'float', 'float_time']).contains(widget.type) ? 'oe-number' : ''}"
t-attf-class="oe_field_#{widget.type} #{_(['integer', 'float', 'float_time']).contains(widget.type) ? 'oe-number' : ''}"
/><img class="oe_field_translate oe_input_icon" t-if="widget.field.translate" t-att-src='_s + "/web/static/src/img/icons/terp-translate.png"' width="16" height="16" border="0"/>
</div>
</t>