[IMP] web: improve code formatting, more

bzr revid: rco@openerp.com-20120904151824-0z51u2cavjtzqpzd
This commit is contained in:
Raphael Collet 2012-09-04 17:18:24 +02:00
parent d6dc264ea2
commit 13e10079b1
2 changed files with 9 additions and 25 deletions

View File

@ -148,19 +148,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
if (this.fields_view.toolbar) {
this.sidebar.add_toolbar(this.fields_view.toolbar);
}
if (self.is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: self.on_button_delete }
]);
}
if (self.is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t('Duplicate'), callback: self.on_button_duplicate }
]);
}
this.sidebar.add_items('other', [
this.sidebar.add_items('other', _.compact([
self.is_action_enabled('delete') && { label: _t('Delete'), callback: self.on_button_delete },
self.is_action_enabled('create') && { label: _t('Duplicate'), callback: self.on_button_duplicate },
{ label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } }
]);
]));
}
this.has_been_loaded.resolve();

View File

@ -357,19 +357,11 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
if (!this.sidebar && this.options.$sidebar) {
this.sidebar = new instance.web.Sidebar(this);
this.sidebar.appendTo(this.options.$sidebar);
if (self.is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t("Import"), callback: this.on_sidebar_import }
]);
}
this.sidebar.add_items('other', [
{ label: _t("Export"), callback: this.on_sidebar_export }
]);
if (self.is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: this.do_delete_selected }
]);
}
this.sidebar.add_items('other', _.compact([
self.is_action_enabled('create') && { label: _t("Import"), callback: this.on_sidebar_import },
{ label: _t("Export"), callback: this.on_sidebar_export },
self.is_action_enabled('delete') && { label: _t('Delete'), callback: this.do_delete_selected }
]));
this.sidebar.add_toolbar(this.fields_view.toolbar);
this.sidebar.$el.hide();
}