[FIX]History Back: Fixed the issue of history back, when calling action history_back it always redirect to home page, instead of previous view

This commit is contained in:
Mohammed Shekha
2015-02-02 10:55:05 +01:00
committed by Géry Debongnie
parent ac8d13a0a1
commit 78d4822abb
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -746,9 +746,9 @@ instance.web.client_actions.add("reload_context", "instance.web.ReloadContext");
* If can't go back in history stack, will go back to home.
*/
instance.web.HistoryBack = function(parent) {
if (!parent.history_back()) {
parent.history_back().fail(function() {
instance.web.Home(parent);
}
});
};
instance.web.client_actions.add("history_back", "instance.web.HistoryBack");
+4 -3
View File
@@ -119,18 +119,19 @@ instance.web.ActionManager = instance.web.Widget.extend({
if (this.widgets.length > 1) {
widget = this.widgets[this.widgets.length - 2];
var index = widget.view_stack && widget.view_stack.length - 1;
this.select_widget(widget, index);
return this.select_widget(widget, index);
}
return $.Deferred().reject();
},
select_widget: function(widget, index) {
var self = this;
if (this.webclient.has_uncommitted_changes()) {
return false;
return $.Deferred().reject();
}
var widget_index = this.widgets.indexOf(widget),
def = $.when(widget.select_view && widget.select_view(index));
def.done(function () {
return def.done(function () {
if (widget.__on_reverse_breadcrumb) {
widget.__on_reverse_breadcrumb();
}