Skip to content
Snippets Groups Projects
Commit fcb82dc5 authored by Xavier Morel's avatar Xavier Morel
Browse files

[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
parent 0eb602dd
Branches
Tags
No related merge requests found
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment