diff options
| author | Aaron Bohy <aab@odoo.com> | 2016-04-21 13:58:22 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2016-04-21 15:21:42 +0200 |
| commit | 6768bbfcc02e0f498110cda2ba9adbc2fd23d24c (patch) | |
| tree | 7dccb1019434582874b285276189b1b3dcbb96a9 /addons/web/static/src/js/views/tree_view.js | |
| parent | e1bfd3fbda97ac7a64a585b07be161d5be606cf9 (diff) | |
| parent | 8e440b173e3b273b3aac541f2ec12527f67dfa60 (diff) | |
[MERGE] *: stop duplicating web
Avoid duplicating web addon in enterprise by extracting a common basis.
Enterprise features stay in enterprise, but use that common basis.
In web, mainly:
- JS refactoring and linting
- Conversion of .sass into .less split into multiple files
- Templates cleaning and DOM simplification
- Re-generation of web.pot, and update of .po files
Minor tweaks in some other addons to make them work with this new structure.
Diffstat (limited to 'addons/web/static/src/js/views/tree_view.js')
| -rw-r--r-- | addons/web/static/src/js/views/tree_view.js | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/addons/web/static/src/js/views/tree_view.js b/addons/web/static/src/js/views/tree_view.js index 6246a1494f5..aeb206257fe 100644 --- a/addons/web/static/src/js/views/tree_view.js +++ b/addons/web/static/src/js/views/tree_view.js @@ -87,7 +87,7 @@ var TreeView = View.extend({ return; } - var $select = self.$el.find('select') + var $select = self.$('select') .change(function () { var $option = $(this).find(':selected'); self.getdata($option.val(), $option.data('children')); @@ -155,8 +155,8 @@ var TreeView = View.extend({ children_ids = record[self.children_field]; _(children_ids).each(function(childid) { - if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').length ) { - if (self.$el.find('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').is(':hidden')) { + if (self.$('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').length ) { + if (self.$('[id=treerow_' + childid + '][data-row-parent-id='+ record_id +']').is(':hidden')) { is_loaded = -1; } else { is_loaded++; @@ -164,7 +164,7 @@ var TreeView = View.extend({ } }); if (is_loaded === 0) { - if (!$this.parent().hasClass('oe_open')) { + if (!$this.parent().hasClass('o_open')) { self.getdata(record_id, children_ids); } } else { @@ -180,7 +180,7 @@ var TreeView = View.extend({ _(records).each(function (record) { self.records[record.id] = record; }); - var $curr_node = self.$el.find('#treerow_' + id); + var $curr_node = self.$('#treerow_' + id); var children_rows = QWeb.render('TreeView.rows', { 'records': records, 'children_field': self.children_field, @@ -192,10 +192,10 @@ var TreeView = View.extend({ 'row_parent_id': id }); if ($curr_node.length) { - $curr_node.addClass('oe_open'); + $curr_node.addClass('o_open'); $curr_node.after(children_rows); } else { - self.$el.find('tbody').html(children_rows); + self.$('tbody').html(children_rows); } }); }, @@ -229,11 +229,11 @@ var TreeView = View.extend({ // show & hide the contents showcontent: function (curnode,record_id, show) { - curnode.parent('tr').toggleClass('oe_open', show); + curnode.parent('tr').toggleClass('o_open', show); _(this.records[record_id][this.children_field]).each(function (child_id) { - var $child_row = this.$el.find('[id=treerow_' + child_id + '][data-row-parent-id='+ curnode.data('id') +']'); - if ($child_row.hasClass('oe_open')) { - $child_row.toggleClass('oe_open',show); + var $child_row = this.$('[id=treerow_' + child_id + '][data-row-parent-id='+ curnode.data('id') +']'); + if ($child_row.hasClass('o_open')) { + $child_row.toggleClass('o_open',show); this.showcontent($child_row, child_id, false); } $child_row.toggle(show); |
