Valentin Lab has proposed merging
lp:~vaab/openerp-web/mobile-client-use-widget-render into
lp:~openerp-dev/openerp-web/mobile-client.
Requested reviews:
Xavier (Open ERP) (xmo)
For more details, see:
https://code.launchpad.net/~vaab/openerp-web/mobile-client-use-widget-render/+merge/76606
These are modification that I had to conduct in mobile-client to be able to
extend/customize the mobile-client with my add-on.
I resubmitted these commits in this branch to fit as best as I could to please
Xavier ;)
Other modification proposed in
"https://code.launchpad.net/~vaab/openerp-web/mobile-client-extendability-patch/+merge/76583"
will be discussed separately in other branches.
Any comments/hints are welcome.
--
https://code.launchpad.net/~vaab/openerp-web/mobile-client-use-widget-render/+merge/76606
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openerp-web/mobile-client.
=== modified file 'addons/web_mobile/static/src/js/chrome_mobile.js'
--- addons/web_mobile/static/src/js/chrome_mobile.js 2011-09-22 12:34:40 +0000
+++ addons/web_mobile/static/src/js/chrome_mobile.js 2011-09-22 15:58:26 +0000
@@ -12,11 +12,14 @@
};
openerp.web_mobile.MobileWebClient = openerp.web.Widget.extend({
+
+ template: "WebClient",
+
init: function(element_id) {
this._super(null, element_id);
- QWeb.add_template("xml/web_mobile.xml");
+ openerp.web.qweb.add_template("xml/web_mobile.xml");
var params = {};
- this.$element.html(QWeb.render("WebClient", {}));
+ this.$element.html(this.render());
this.session = new openerp.web.Session("oe_errors");
this.crashmanager = new openerp.web.CrashManager(this);
this.login = new openerp.web_mobile.Login(this, "oe_login");
@@ -29,6 +32,9 @@
});
openerp.web_mobile.Login = openerp.web.Widget.extend({
+
+ template: "Login",
+
start: function() {
var self = this;
jQuery("#oe_header").children().remove();
@@ -36,7 +42,7 @@
this.rpc("/web/database/get_list", {}, function(result) {
var selection = new openerp.web_mobile.Selection();
self.db_list = result.db_list;
- self.$element.html(QWeb.render("Login", self));
+ self.$element.html(self.render(self));
if(self.session.db!=""){
self.$element.find("#database").val(self.session.db);
self.$element.find("#login").val(self.session.login);
@@ -91,31 +97,39 @@
}
});
openerp.web_mobile.Header = openerp.web.Widget.extend({
+
+ template: "Header",
+
init: function(session, element_id) {
this._super(session, element_id);
},
start: function() {
- this.$element.html(QWeb.render("Header", this));
+ this.$element.html(this.render(this));
}
});
openerp.web_mobile.Footer = openerp.web.Widget.extend({
+
+ template: "Footer",
+
init: function(session, element_id) {
this._super(session, element_id);
},
start: function() {
- this.$element.html(QWeb.render("Footer", this));
+ this.$element.html(this.render(this));
}
});
openerp.web_mobile.Shortcuts = openerp.web.Widget.extend({
+
+ template: "Shortcuts",
init: function(session, element_id) {
this._super(session, element_id);
},
start: function() {
var self = this;
this.rpc('/web/session/sc_list',{} ,function(res){
- self.$element.html(QWeb.render("Shortcuts", {'sc' : res}))
+ self.$element.html(this.render({'sc' : res}))
self.$element.find("[data-role=header]").find('h1').html('Favourite');
self.$element.find("[data-role=header]").find('#home').click(function(){
@@ -156,6 +170,9 @@
});
openerp.web_mobile.Menu = openerp.web.Widget.extend({
+
+ template: "Menu",
+
init: function(session, element_id, secondary_menu_id) {
this._super(session, element_id);
this.secondary_menu_id = secondary_menu_id;
@@ -173,7 +190,7 @@
this.footer = new openerp.web_mobile.Footer(this, "oe_footer");
this.footer.start();
- this.$element.html(QWeb.render("Menu", this.data));
+ this.$element.html(this.render(this.data));
this.$element.find("[data-role=header]").find('h1').html('Application');
this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
@@ -220,6 +237,9 @@
}
});
openerp.web_mobile.Secondary = openerp.web.Widget.extend({
+
+ template: "Menu.secondary",
+
init: function(session, element_id, secondary_menu_id) {
this._super(session, element_id);
this.data = secondary_menu_id;
@@ -228,7 +248,7 @@
var self = this;
var v = { menu : this.data };
- this.$element.html(QWeb.render("Menu.secondary", v));
+ this.$element.html(this.render(v));
this.$element.find("[data-role=header]").find("h1").html(this.data.name);
this.$element.add(this.$secondary_menu).find('#content').find("a").click(this.on_menu_click);
@@ -274,10 +294,13 @@
});
openerp.web_mobile.Options = openerp.web.Widget.extend({
+
+ template: "Options",
+
start: function() {
var self = this;
- this.$element.html(QWeb.render("Options", this));
+ this.$element.html(this.render(this));
this.$element.find("[data-role=header]").find('h1').html('Preference');
this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
=== modified file 'addons/web_mobile/static/src/js/form_mobile.js'
--- addons/web_mobile/static/src/js/form_mobile.js 2011-09-22 12:34:40 +0000
+++ addons/web_mobile/static/src/js/form_mobile.js 2011-09-22 15:58:26 +0000
@@ -5,6 +5,9 @@
openerp.web_mobile.form_mobile = function (openerp) {
openerp.web_mobile.FormView = openerp.web.Widget.extend({
+
+ template: 'FormView',
+
init: function(session, element_id, list_id, action, head_title, resmodel, viewid) {
this._super(session, element_id);
this.list_id = list_id;
@@ -45,7 +48,7 @@
var notebooks = view_fields[j];
}
}
- self.$element.html(QWeb.render("FormView", {'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : data ,'temp_flag':'1'}));
+ self.$element.html(self.render({'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : fields, 'values' : data ,'temp_flag':'1'}));
self.$element.find("[data-role=header]").find('h1').html(self.head_title);
self.$element.find("[data-role=header]").find('#home').click(function(){
@@ -101,9 +104,9 @@
}
if(notebook){
- $(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data,'til': notebook.attrs.string }));
+ $(this).find('p').html(self.render({'get_fields': get_fields,'fields' : result.fields, 'values' : data,'til': notebook.attrs.string }));
}else{
- $(this).find('p').html(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields, 'values' : data }));
+ $(this).find('p').html(self.render({'get_fields': get_fields,'fields' : result.fields, 'values' : data }));
}
$(this).find('p').find('#formbutton').click(function(){
var head = $(this).prev().find('select').find("option:selected").text();
@@ -147,7 +150,7 @@
}
if(!$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html()){
$('<div id="oe_list_'+relational+'_'+self.element_id+'" data-role="page" data-url="oe_list_'+relational+'_'+self.element_id+'"> </div>').appendTo('#moe');
- $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(QWeb.render("ListView", {'records' : res}));
+ $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(openerp.web.qweb.render("ListView", {'records' : res}));
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('h1').html(head);
$('[id^="oe_list_'+relational+'_'+self.element_id+'"]').find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
@@ -199,7 +202,7 @@
}
}
}
- $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(QWeb.render("FormView", {'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' }));
+ $('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').html(self.render({'get_fields': get_fields_test, 'notebooks': false, 'fields' : fields_test, 'values' : data_relational, 'temp_flag':'1' }));
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('h1').html(head_title);
$('[id^="oe_form_'+listid+result.fields[relational].relation+'"]').find("[data-role=header]").find('#home').click(function(){
=== modified file 'addons/web_mobile/static/src/js/list_mobile.js'
--- addons/web_mobile/static/src/js/list_mobile.js 2011-09-22 12:34:40 +0000
+++ addons/web_mobile/static/src/js/list_mobile.js 2011-09-22 15:58:26 +0000
@@ -5,6 +5,9 @@
openerp.web_mobile.list_mobile = function (openerp) {
openerp.web_mobile.ListView = openerp.web.Widget.extend({
+
+ template: 'ListView',
+
init: function(session, element_id, list_id) {
this._super(session, element_id);
this.list_id = list_id;
@@ -24,7 +27,7 @@
var self = this;
var dataset = new openerp.web.DataSetStatic(this, this.action.res_model, this.action.context);
dataset.name_search('', [], 'ilike',false ,function(result){
- self.$element.html(QWeb.render("ListView", {'records' : result}));
+ self.$element.html(self.render({'records' : result}));
self.$element.find("[data-role=header]").find('h1').html(self.action.name);
self.$element.find("[data-role=header]").find('#home').click(function(){
$.mobile.changePage("#oe_menu", "slide", false, true);
_______________________________________________
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