+ $('<button>Debug layout</button>').appendTo(this.$element).click($.proxy(this.toggle_layout_debugging, this));
+ },
+ render_element: function(template, dict) {
+ dict = dict || {};
+ dict.legacy_mode = this.legacy_mode;
+ return $(QWeb.render(template, dict));
+ },
+ alter_field: function(field) {},
+ toggle_layout_debugging: function() {
+ if (!this.$element.has('.oe_layout_debug_cell:first').length) {
+ this.$element.find('.oe_form_group_cell').each(function() {
+ var text = 'W:' + ($(this).attr('width') || '') + ' - C:' + $(this).attr('colspan'),
+ $span = $('<span class="oe_layout_debug_cell"/>').text(text);
+ $span.prependTo($(this));
+ });
+ }
+ this.$element.toggleClass('oe_layout_debugging');
+
+ },
+ process: function($tag) {
+ var self = this;
+ var tagname = $tag[0].nodeName.toLowerCase();
+ var fn = self['process_' + tagname];
+ if (this.registry && this.registry.contains(tagname)) {
+ fn = this.registry.get_object(tagname);
+ }
+ if (fn) {
+ var args = [].slice.call(arguments);
+ args[0] = $tag;
+ return fn.apply(self, args);
+ } else {
+ // generic tag handling, just process children
+ $tag.children().each(function() {
+ self.process($(this));
+ });
+ return $tag;
+ }