diff options
| author | Xavier Morel <xmo@openerp.com> | 2014-06-05 13:10:48 +0200 |
|---|---|---|
| committer | Xavier Morel <xmo@openerp.com> | 2014-06-05 13:10:48 +0200 |
| commit | fcb82dc5f1cc4c81dabd2f0be318d4774a630e54 (patch) | |
| tree | d1ffccb442238b801e3271472d19073c5bc362fd /addons/website/static/src/js | |
| parent | 0eb602dd61e0072937f5b3218959da51b9ac4d5d (diff) | |
[IMP] add XID to view name in Ace editor dropdown
When looking for template bit to override or alter (in-core) through the Ace
editor, displaying only the name is a pain:
- the name generally sucks diseased donkey balls
- having to go through the code to find out what the template's XID is is a
waste of time
Diffstat (limited to 'addons/website/static/src/js')
| -rw-r--r-- | addons/website/static/src/js/website.ace.js | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/addons/website/static/src/js/website.ace.js b/addons/website/static/src/js/website.ace.js index 27e5cd60e62..e1c45065c33 100644 --- a/addons/website/static/src/js/website.ace.js +++ b/addons/website/static/src/js/website.ace.js @@ -65,12 +65,13 @@ website.ace.ViewOption = openerp.Widget.extend({ template: 'website.ace_view_option', init: function (parent, options) { - var indent = "- "; this.view_id = options.id; this.view_name = options.name; - for (var i = 0; i<options.level; i++) { - this.view_name = indent + this.view_name; - } + + var indent = _.str.repeat("- ", options.level); + this.view_name = _.str.sprintf( + "%s%s (%s)", + indent, options.name, options.xml_id); this._super(parent); }, }); @@ -162,15 +163,13 @@ resizeEditorHeight(this.getParent().get('height')); }, loadViews: function (views) { - var self = this; - var $viewList = self.$('#ace-view-list'); - var views = this.buildViewGraph(views); - _.each(views, function (view) { - if (view.id) { - new website.ace.ViewOption(self, view).appendTo($viewList); - self.loadView(view.id); - } - }); + var $viewList = this.$('#ace-view-list'); + _(this.buildViewGraph(views)).each(function (view) { + if (!view.id) { return; } + + new website.ace.ViewOption(this, view).appendTo($viewList); + this.loadView(view.id); + }.bind(this)); }, buildViewGraph: function (views) { var activeViews = _.uniq(_.filter(views, function (view) { |
