[MERGE] url rework
bzr revid: al@openerp.com-20111214180602-dw5qc2tfz3o48emj
This commit is contained in:
@@ -1061,7 +1061,6 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
|
||||
if(this.action_manager)
|
||||
this.action_manager.stop();
|
||||
this.action_manager = new openerp.web.ActionManager(this);
|
||||
this.action_manager.do_push_state.add(this.do_push_state);
|
||||
this.action_manager.appendTo($("#oe_app"));
|
||||
|
||||
if (openerp._modules_loaded) { // TODO: find better option than this
|
||||
@@ -1076,7 +1075,7 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
|
||||
},
|
||||
on_logged_out: function() {
|
||||
$(window).unbind('hashchange', this.on_hashchange);
|
||||
this.do_push_state({},true);
|
||||
this.do_push_state({});
|
||||
if(this.action_manager)
|
||||
this.action_manager.stop();
|
||||
this.action_manager = null;
|
||||
@@ -1098,11 +1097,7 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
|
||||
}
|
||||
this._current_state = state;
|
||||
},
|
||||
do_push_state: function(state, overwrite) {
|
||||
if (!overwrite) {
|
||||
var hash = $.deparam.fragment(true);
|
||||
state = _.extend({}, hash, state);
|
||||
}
|
||||
do_push_state: function(state) {
|
||||
var url = '#' + $.param(state);
|
||||
this._current_state = _.clone(state);
|
||||
$.bbq.pushState(url);
|
||||
|
||||
@@ -175,6 +175,9 @@ openerp.web.FormView = openerp.web.View.extend( /** @lends openerp.web.FormView#
|
||||
if (self.default_focus_field && !self.embedded_view) {
|
||||
self.default_focus_field.focus();
|
||||
}
|
||||
if (record.id) {
|
||||
self.do_push_state({id:record.id});
|
||||
}
|
||||
});
|
||||
},
|
||||
on_form_changed: function() {
|
||||
|
||||
@@ -20,6 +20,7 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
identifier_prefix: "actionmanager",
|
||||
init: function(parent) {
|
||||
this._super(parent);
|
||||
this.inner_action = null;
|
||||
this.inner_viewmanager = null;
|
||||
this.dialog = null;
|
||||
this.dialog_viewmanager = null;
|
||||
@@ -46,10 +47,14 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
this.client_widget = null;
|
||||
}
|
||||
},
|
||||
|
||||
do_push_state: function(state, overwrite) {
|
||||
do_push_state: function(state) {
|
||||
if (this.widget_parent && this.widget_parent.do_push_state) {
|
||||
if (this.inner_action && this.inner_action.id) {
|
||||
state['action_id'] = this.inner_action.id;
|
||||
}
|
||||
this.widget_parent.do_push_state(state);
|
||||
}
|
||||
},
|
||||
|
||||
do_load_state: function(state) {
|
||||
if (state.action_id) {
|
||||
this.null_action();
|
||||
@@ -69,7 +74,6 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
this.inner_viewmanager.do_load_state(state);
|
||||
}
|
||||
},
|
||||
|
||||
do_action: function(action, on_close) {
|
||||
if (_.isNumber(action)) {
|
||||
var self = this;
|
||||
@@ -128,10 +132,6 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
this.content_stop();
|
||||
this.inner_action = action;
|
||||
this.inner_viewmanager = new session.web.ViewManagerAction(this, action);
|
||||
this.inner_viewmanager.do_push_state.add(function(state,overwrite) {
|
||||
state['action_id'] = action.id;
|
||||
self.do_push_state(state,true);
|
||||
});
|
||||
this.inner_viewmanager.appendTo(this.$element);
|
||||
}
|
||||
},
|
||||
@@ -155,10 +155,6 @@ session.web.ActionManager = session.web.Widget.extend({
|
||||
this.dialog_stop();
|
||||
var ClientWidget = session.web.client_actions.get_object(action.tag);
|
||||
(this.client_widget = new ClientWidget(this, action.params)).appendTo(this);
|
||||
|
||||
var client_action = {tag: action.tag};
|
||||
if (action.params) _.extend(client_action, {params: action.params});
|
||||
this.do_push_state({client_action: client_action}, true);
|
||||
},
|
||||
ir_actions_report_xml: function(action, on_closed) {
|
||||
var self = this;
|
||||
@@ -315,8 +311,6 @@ session.web.ViewManager = session.web.Widget.extend(/** @lends session.web.View
|
||||
});
|
||||
return view_promise;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Returns to the view preceding the caller view in this manager's
|
||||
* navigation history (the navigation history is appended to via
|
||||
@@ -392,7 +386,8 @@ session.web.ViewManager = session.web.Widget.extend(/** @lends session.web.View
|
||||
/**
|
||||
* Called by children view after executing an action
|
||||
*/
|
||||
on_action_executed: function () {},
|
||||
on_action_executed: function () {
|
||||
},
|
||||
display_title: function () {
|
||||
var view = this.views[this.active_view];
|
||||
if (view) {
|
||||
@@ -467,12 +462,6 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner
|
||||
|
||||
var main_view_loaded = this._super();
|
||||
|
||||
_.each(_.keys(this.views), function(view_type) {
|
||||
$.when(self.views[view_type].deferred).done(function(view_type) {
|
||||
self.views[view_type].controller.do_push_state.add(self.do_push_state);
|
||||
});
|
||||
});
|
||||
|
||||
var manager_ready = $.when(searchview_loaded, main_view_loaded);
|
||||
|
||||
this.$element.find('.oe_debug_view').change(this.on_debug_changed);
|
||||
@@ -585,21 +574,20 @@ session.web.ViewManagerAction = session.web.ViewManager.extend(/** @lends oepner
|
||||
} else {
|
||||
$search_prefix.remove();
|
||||
}
|
||||
|
||||
self.do_push_state({view_type: self.active_view});
|
||||
});
|
||||
},
|
||||
|
||||
do_push_state: function(state, overwrite) {
|
||||
do_push_state: function(state) {
|
||||
if (this.widget_parent && this.widget_parent.do_push_state) {
|
||||
state["view_type"] = this.active_view;
|
||||
this.widget_parent.do_push_state(state);
|
||||
}
|
||||
},
|
||||
|
||||
do_load_state: function(state) {
|
||||
var self = this;
|
||||
$.when(this.on_mode_switch(state.view_type, true)).done(function() {
|
||||
self.views[self.active_view].controller.do_load_state(state);
|
||||
});
|
||||
},
|
||||
|
||||
shortcut_check : function(view) {
|
||||
var self = this;
|
||||
var grandparent = this.widget_parent && this.widget_parent.widget_parent;
|
||||
@@ -1067,10 +1055,18 @@ session.web.View = session.web.Widget.extend(/** @lends session.web.View# */{
|
||||
},
|
||||
do_show: function () {
|
||||
this.$element.show();
|
||||
this.do_push_state({});
|
||||
},
|
||||
do_hide: function () {
|
||||
this.$element.hide();
|
||||
},
|
||||
do_push_state: function(state) {
|
||||
if (this.widget_parent && this.widget_parent.do_push_state) {
|
||||
this.widget_parent.do_push_state(state);
|
||||
}
|
||||
},
|
||||
do_load_state: function(state) {
|
||||
},
|
||||
/**
|
||||
* Switches to a specific view type
|
||||
*
|
||||
@@ -1153,10 +1149,6 @@ 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) {
|
||||
}
|
||||
});
|
||||
|
||||
session.web.json_node_to_xml = function(node, human_readable, indent) {
|
||||
|
||||
Reference in New Issue
Block a user