Antony Lesuisse (OpenERP) has proposed merging
lp:~openerp-dev/openerp-web/trunk-pushstate2-chs into lp:openerp-web.
Requested reviews:
OpenERP R&D Web Team (openerp-dev-web)
For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-pushstate2-chs/+merge/85699
better url handling
--
https://code.launchpad.net/~openerp-dev/openerp-web/trunk-pushstate2-chs/+merge/85699
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/trunk-pushstate2-chs.
=== modified file 'addons/web/static/src/js/chrome.js'
--- addons/web/static/src/js/chrome.js 2011-12-14 10:43:01 +0000
+++ addons/web/static/src/js/chrome.js 2011-12-14 16:42:16 +0000
@@ -1053,7 +1053,6 @@
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
@@ -1068,7 +1067,7 @@
},
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;
@@ -1090,11 +1089,8 @@
}
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) {
+ console.log('dopushstate', state);
var url = '#' + $.param(state);
this._current_state = _.clone(state);
$.bbq.pushState(url);
=== modified file 'addons/web/static/src/js/view_form.js'
--- addons/web/static/src/js/view_form.js 2011-12-14 15:54:41 +0000
+++ addons/web/static/src/js/view_form.js 2011-12-14 16:42:16 +0000
@@ -175,6 +175,9 @@
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() {
=== modified file 'addons/web/static/src/js/views.js'
--- addons/web/static/src/js/views.js 2011-12-14 15:29:03 +0000
+++ addons/web/static/src/js/views.js 2011-12-14 16:42:16 +0000
@@ -20,6 +20,7 @@
identifier_prefix: "actionmanager",
init: function(parent) {
this._super(parent);
+ this.action = null;
this.inner_viewmanager = null;
this.dialog = null;
this.dialog_viewmanager = null;
@@ -47,7 +48,15 @@
}
},
- do_push_state: function(state, overwrite) {
+ do_push_state: function(state) {
+ if (this.wiget_parent && this.widget_parent.do_push_state) {
+ if (this.action.id) {
+ state = _.extend({}, state || {}, {
+ action_id: this.action.id,
+ });
+ }
+ this.widget_parent.do_push_state(state);
+ }
},
do_load_state: function(state) {
@@ -95,6 +104,7 @@
console.error("Action manager can't handle action of type " + action.type, action);
return;
}
+ this.action = action;
return this[type](action, on_close);
},
null_action: function() {
@@ -128,10 +138,6 @@
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);
}
},
@@ -154,10 +160,6 @@
this.content_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;
@@ -466,12 +468,6 @@
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);
@@ -584,12 +580,16 @@
} 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.wiget_parent && this.widget_parent.do_push_state) {
+ state = _.extend({}, state || {}, {
+ view_type: this.active_view
+ });
+ this.widget_parent.do_push_state(state);
+ }
},
do_load_state: function(state) {
@@ -1146,11 +1146,12 @@
return $.Deferred().resolve({}).promise();
},
- do_push_state: function(state, overwrite) {
+ do_push_state: function(state) {
+ if (this.wiget_parent && this.widget_parent.do_push_state) {
+ this.widget_parent.do_push_state(state);
+ }
},
- do_load_state: function(state) {
- }
});
session.web.json_node_to_xml = function(node, human_readable, indent) {
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp