[IMP] fix code spacing and indentation

bzr revid: rco@openerp.com-20120831153758-3l46jbvtifix5s9v
This commit is contained in:
Raphael Collet 2012-08-31 17:37:58 +02:00
parent 0304a1eada
commit 3e5c6a4d95
6 changed files with 22 additions and 22 deletions

View File

@ -145,15 +145,15 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
if (!this.sidebar && this.options.$sidebar) {
this.sidebar = new instance.web.Sidebar(this);
this.sidebar.appendTo(this.$sidebar);
if(this.fields_view.toolbar) {
if (this.fields_view.toolbar) {
this.sidebar.add_toolbar(this.fields_view.toolbar);
}
if (self._is_action_enabled('delete')){
if (self._is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: self.on_button_delete },
{ label: _t('Delete'), callback: self.on_button_delete }
]);
}
if (self._is_action_enabled('create')){
if (self._is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t('Duplicate'), callback: self.on_button_duplicate }
]);
@ -3469,8 +3469,8 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
}
},
do_activate_record: function(index, id) {
var self = this,
attr_readonly = (_.has(this.fields_view.arch.attrs, 'edit'))?JSON.parse(this.fields_view.arch.attrs.edit):true;
var self = this;
var attr_readonly = (_.has(this.fields_view.arch.attrs, 'edit')) ? JSON.parse(this.fields_view.arch.attrs.edit) : true;
var pop = new instance.web.form.FormOpenPopup(self.o2m.view);
pop.show_element(self.o2m.field.relation, id, self.o2m.build_context(), {
title: _t("Open: ") + self.o2m.string,
@ -3587,7 +3587,7 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({
}).length;
if (this.options.selectable) { columns++; }
if (this.options.deletable) { columns++; }
if (this.view._is_action_enabled('create')){
if (this.view._is_action_enabled('create')) {
var $cell = $('<td>', {
colspan: columns,
'class': 'oe_form_field_one2many_list_row_add'

View File

@ -351,7 +351,7 @@ 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')){
if (self._is_action_enabled('create')) {
this.sidebar.add_items('other', [
{ label: _t("Import"), callback: this.on_sidebar_import }
]);
@ -359,7 +359,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.sidebar.add_items('other', [
{ label: _t("Export"), callback: this.on_sidebar_export }
]);
if (self._is_action_enabled('delete')){
if (self._is_action_enabled('delete')) {
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: this.do_delete_selected }
]);

View File

@ -1358,13 +1358,13 @@ instance.web.View = instance.web.Widget.extend({
reload: function () {
return $.when();
},
_is_action_enabled: function(action) {
/**
* Takes action (e.g. create/edit/delete) and return the tag attribute from
* the view (e.g. <from string="" create="false" edit="false" delete="false">)
* will help to check access ui of the view.
* Return whether the user can perform the action ('create', 'edit', 'delete') in this view.
* An action is disabled by setting the corresponding attribute in the view's main element,
* like: <form string="" create="false" edit="false" delete="false">
*/
return (_.has(this.fields_view.arch.attrs, action))?JSON.parse(this.fields_view.arch.attrs[action]):true;
_is_action_enabled: function(action) {
return (_.has(this.fields_view.arch.attrs, action)) ? JSON.parse(this.fields_view.arch.attrs[action]) : true;
}
});

View File

@ -2,11 +2,11 @@
<t t-name="DiagramView">
<div class="oe_diagram_header" t-att-id="element_id + '_header'">
<h3 class="oe_diagram_title"/>
<t t-if="widget._is_action_enabled('create')">
<div class="oe_diagram_buttons">
<button type="button" id="new_node" class="oe_button oe_diagram_button_new">New Node</button>
</div>
</t>
<t t-if="widget._is_action_enabled('create')">
<div class="oe_diagram_buttons">
<button type="button" id="new_node" class="oe_button oe_diagram_button_new">New Node</button>
</div>
</t>
<div class="oe_diagram_pager">
<t t-call="ViewPager">
<span class="oe_pager_index">0</span> / <span class="oe_pager_count">0</span>

View File

@ -183,7 +183,7 @@ instance.web_gantt.GanttView = instance.web.View.extend({
self.on_task_display(task_info.internal_task);
}
});
if (this._is_action_enabled('create')){
if (this._is_action_enabled('create')) {
// insertion of create button
var td = $($("table td", self.$el)[0]);
var rendered = QWeb.render("GanttView-create-button");

View File

@ -742,7 +742,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
var $action = $(this),
type = $action.data('type') || 'button',
method = 'do_action_' + (type === 'action' ? 'object' : type);
if ((type === 'edit' || type === 'delete') && ! self.view._is_action_enabled(type)){
if ((type === 'edit' || type === 'delete') && ! self.view._is_action_enabled(type)) {
self.view.open_record(self.id);
} else if (_.str.startsWith(type, 'switch_')) {
self.view.do_switch_view(type.substr(7));
@ -916,7 +916,7 @@ instance.web_kanban.KanbanRecord = instance.web.Widget.extend({
return instance.web.form.compute_domain(domain, this.values);
},
_is_action_enabled: function(action) {
return (_.has(this.fields_view.arch.attrs, action))?JSON.parse(this.fields_view.arch.attrs[action]):true;
return (_.has(this.fields_view.arch.attrs, action)) ? JSON.parse(this.fields_view.arch.attrs[action]) : true;
}
});