[IMP] factorise View.do_show do_hide

bzr revid: al@openerp.com-20111214171811-c4bka4nwylp3wn21
This commit is contained in:
Antony Lesuisse 2011-12-14 18:18:11 +01:00
parent f2d8bef2ea
commit d1ddc1ee78
8 changed files with 15 additions and 38 deletions

View File

@ -125,14 +125,14 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
} else {
promise = this.dataset.read_index(_.keys(this.fields_view.fields)).pipe(this.on_record_loaded);
}
this.$element.show();
this._super();
if (this.sidebar) {
this.sidebar.$element.show();
}
return promise;
},
do_hide: function () {
this.$element.hide();
this._super();
if (this.sidebar) {
this.sidebar.$element.hide();
}

View File

@ -402,13 +402,13 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
}, this));
},
do_show: function () {
this.$element.show();
this._super();
if (this.sidebar) {
this.sidebar.$element.show();
}
},
do_hide: function () {
this.$element.hide();
this._super();
if (this.sidebar) {
this.sidebar.$element.hide();
}

View File

@ -1065,19 +1065,26 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
this.embedded_view = embedded_view;
this.options.sidebar = false;
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
},
/**
* Switches to a specific view type
*
* @param {String} view view type to switch to
*/
do_switch_view: function(view) { },
do_switch_view: function(view) {
},
/**
* Cancels the switch to the current view, switches to the previous one
*/
do_prev_view: function () { },
do_prev_view: function () {
},
do_search: function(view) {
},
set_common_sidebar_sections: function(sidebar) {
sidebar.add_default_sections();
},
@ -1146,10 +1153,8 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
sidebar_context: function () {
return $.Deferred().resolve({}).promise();
},
do_push_state: function(state, overwrite) {
},
do_load_state: function(state) {
}
});

View File

@ -394,7 +394,7 @@ openerp.web_calendar.CalendarView = openerp.web.View.extend({
});
},
do_hide: function () {
this.$element.hide();
this._super();
if (this.sidebar) {
this.sidebar.$element.hide();
}

View File

@ -298,14 +298,6 @@ openerp.web.DiagramView = openerp.web.View.extend({
}
$pager.find('span.oe_pager_index').html(index);
$pager.find('span.oe_pager_count').html(this.dataset.count);
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
}
});
};

View File

@ -459,14 +459,6 @@ openerp.web_gantt.GanttView = openerp.web.View.extend({
}
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
},
convert_str_date: function (str) {
if (typeof str == 'string') {
if (str.length == 19) {

View File

@ -37,12 +37,6 @@ openerp.web_graph.GraphView = openerp.web.View.extend({
}
this._super();
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
},
start: function() {
var self = this;
this._super();

View File

@ -258,12 +258,6 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
});
}
},
do_show: function () {
this.$element.show();
},
do_hide: function () {
this.$element.hide();
},
compute_groups_width: function() {
var unfolded = 0;
_.each(this.groups, function(group) {