[WIP] breadcrumb
bzr revid: fme@openerp.com-20120705080450-j1o7p0vebjtd4ch3
This commit is contained in:
@@ -287,10 +287,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
|
|||||||
on_record_loaded: function(record) {
|
on_record_loaded: function(record) {
|
||||||
var self = this, set_values = [];
|
var self = this, set_values = [];
|
||||||
if (!record) {
|
if (!record) {
|
||||||
|
this.set({ 'title' : undefined });
|
||||||
this.do_warn("Form", "The record could not be found in the database.", true);
|
this.do_warn("Form", "The record could not be found in the database.", true);
|
||||||
return $.Deferred().reject();
|
return $.Deferred().reject();
|
||||||
}
|
}
|
||||||
this.datarecord = record;
|
this.datarecord = record;
|
||||||
|
this.set({ 'title' : record.id ? record.name : "New record" });
|
||||||
|
|
||||||
if (this.qweb) {
|
if (this.qweb) {
|
||||||
this.kill_current_form();
|
this.kill_current_form();
|
||||||
|
|||||||
@@ -156,25 +156,44 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||||||
} else {
|
} else {
|
||||||
this.dialog_stop();
|
this.dialog_stop();
|
||||||
//this.content_stop();
|
//this.content_stop();
|
||||||
this.breadcrumb.hide_all();
|
this.breadcrumb.hide_items();
|
||||||
if(action.menu_id) {
|
if(action.menu_id) {
|
||||||
return this.getParent().do_action(action, function () {
|
return this.getParent().do_action(action, function () {
|
||||||
instance.webclient.menu.open_menu(action.menu_id);
|
instance.webclient.menu.open_menu(action.menu_id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.inner_action = action;
|
this.inner_action = action;
|
||||||
this.inner_viewmanager = new instance.web.ViewManagerAction(this, action);
|
var inner_viewmanager = this.inner_viewmanager = new instance.web.ViewManagerAction(this, action);
|
||||||
this.inner_viewmanager.appendTo(this.$element);
|
this.inner_viewmanager.appendTo(this.$element);
|
||||||
this.inner_viewmanager.$element.addClass("oe_view_manager_" + action.target);
|
this.inner_viewmanager.$element.addClass("oe_view_manager_" + action.target);
|
||||||
|
|
||||||
this.breadcrumb.push({
|
this.breadcrumb.push({
|
||||||
widget: this.inner_viewmanager,
|
widget: inner_viewmanager,
|
||||||
|
show: function() {
|
||||||
|
inner_viewmanager.$element.show();
|
||||||
|
inner_viewmanager.on_mode_switch(action.view_mode.split(',')[0]);
|
||||||
|
},
|
||||||
action: action,
|
action: action,
|
||||||
title: action.name
|
title: action.name
|
||||||
});
|
});
|
||||||
// show
|
inner_viewmanager.on_mode_switch.add_first(function(mode) {
|
||||||
// hide
|
if (mode === 'form' && !inner_viewmanager.views[mode].controller) {
|
||||||
// destroy
|
self.breadcrumb.push({
|
||||||
// title // all view get_title ??
|
widget: inner_viewmanager,
|
||||||
|
show: function() {
|
||||||
|
inner_viewmanager.$element.show();
|
||||||
|
inner_viewmanager.on_mode_switch('form');
|
||||||
|
},
|
||||||
|
action: action,
|
||||||
|
get_title: function() {
|
||||||
|
var form = inner_viewmanager.views['form'].controller;
|
||||||
|
if (form) {
|
||||||
|
return form.get('title');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ir_actions_act_window_close: function (action, on_closed) {
|
ir_actions_act_window_close: function (action, on_closed) {
|
||||||
@@ -195,7 +214,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
|
|||||||
ir_actions_client: function (action) {
|
ir_actions_client: function (action) {
|
||||||
//this.content_stop();
|
//this.content_stop();
|
||||||
this.dialog_stop();
|
this.dialog_stop();
|
||||||
this.breadcrumb.hide_all();
|
this.breadcrumb.hide_items();
|
||||||
var ClientWidget = instance.web.client_actions.get_object(action.tag);
|
var ClientWidget = instance.web.client_actions.get_object(action.tag);
|
||||||
(this.client_widget = new ClientWidget(this, action.params)).appendTo(this.$element);
|
(this.client_widget = new ClientWidget(this, action.params)).appendTo(this.$element);
|
||||||
this.breadcrumb.push({
|
this.breadcrumb.push({
|
||||||
@@ -260,7 +279,7 @@ instance.web.BreadCrumb = instance.web.CallbackEnabled.extend({
|
|||||||
}
|
}
|
||||||
if (!item.get_title) {
|
if (!item.get_title) {
|
||||||
item.get_title = function() {
|
item.get_title = function() {
|
||||||
return item.action.name;
|
return item.title || item.action.name;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.items.push(item);
|
this.items.push(item);
|
||||||
@@ -270,7 +289,7 @@ instance.web.BreadCrumb = instance.web.CallbackEnabled.extend({
|
|||||||
this.remove_item(this.items.length - 1);
|
this.remove_item(this.items.length - 1);
|
||||||
this.select_item(this.items.length - 1);
|
this.select_item(this.items.length - 1);
|
||||||
},
|
},
|
||||||
hide_all: function() {
|
hide_items: function() {
|
||||||
_.each(this.items, function(i) {
|
_.each(this.items, function(i) {
|
||||||
i.hide();
|
i.hide();
|
||||||
});
|
});
|
||||||
@@ -1164,12 +1183,6 @@ instance.web.View = instance.web.Widget.extend({
|
|||||||
}
|
}
|
||||||
this.translate_dialog.open(field);
|
this.translate_dialog.open(field);
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
* Get the title of the view
|
|
||||||
*/
|
|
||||||
get_title: function() {
|
|
||||||
return "";
|
|
||||||
},
|
|
||||||
/**
|
/**
|
||||||
* Fetches and executes the action identified by ``action_data``.
|
* Fetches and executes the action identified by ``action_data``.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user