summaryrefslogtreecommitdiff
path: root/addons/web_mobile/static/src
diff options
context:
space:
mode:
authorniv-openerp <nicolas.vanhoren@openerp.com>2012-04-17 14:48:30 +0200
committerniv-openerp <nicolas.vanhoren@openerp.com>2012-04-17 14:48:30 +0200
commiteab7adeacf3268836caf8d95d403f0aabc825dca (patch)
treeabfde6c7ec35fc8f92e0bb5453064c6ffa7d7ff9 /addons/web_mobile/static/src
parent13e64388249c6c3ad6ff86c0109914a02fb25e6a (diff)
[imp] remaining of refactoring for 'openerp'
bzr revid: nicolas.vanhoren@openerp.com-20120417124830-6vy3nsjch3w94rt2
Diffstat (limited to 'addons/web_mobile/static/src')
-rw-r--r--addons/web_mobile/static/src/js/chrome_mobile.js48
-rw-r--r--addons/web_mobile/static/src/js/form_mobile.js20
-rw-r--r--addons/web_mobile/static/src/js/list_mobile.js10
3 files changed, 39 insertions, 39 deletions
diff --git a/addons/web_mobile/static/src/js/chrome_mobile.js b/addons/web_mobile/static/src/js/chrome_mobile.js
index a28956a0cab..a507e3b5943 100644
--- a/addons/web_mobile/static/src/js/chrome_mobile.js
+++ b/addons/web_mobile/static/src/js/chrome_mobile.js
@@ -2,36 +2,36 @@
* OpenERP Web Mobile chrome
*---------------------------------------------------------*/
-openerp.web_mobile.chrome_mobile = function(openerp) {
+openerp.web_mobile.chrome_mobile = function(instance) {
-openerp.web_mobile.mobilewebclient = function(element_id) {
- // TODO Helper to start mobile webclient rename it openerp.web.webclient
- var client = new openerp.web_mobile.MobileWebClient(element_id);
+instance.web_mobile.mobilewebclient = function(element_id) {
+ // TODO Helper to start mobile webclient rename it instance.web.webclient
+ var client = new instance.web_mobile.MobileWebClient(element_id);
client.start();
return client;
};
-openerp.web_mobile.MobileWebClient = openerp.web.OldWidget.extend({
+instance.web_mobile.MobileWebClient = instance.web.OldWidget.extend({
template: "WebClient",
init: function(element_id) {
this._super(null, element_id);
- this.crashmanager = new openerp.web.CrashManager(this);
- this.login = new openerp.web_mobile.Login(this, "oe_login");
+ this.crashmanager = new instance.web.CrashManager(this);
+ this.login = new instance.web_mobile.Login(this, "oe_login");
},
start: function() {
this._super.apply(this, arguments);
var self = this;
this.session.bind_session().then(function() {
- openerp.web.qweb.add_template("xml/web_mobile.xml");
+ instance.web.qweb.add_template("xml/web_mobile.xml");
self.$element.html(self.render());
self.login.start();
});
}
});
-openerp.web_mobile.Login = openerp.web.OldWidget.extend({
+instance.web_mobile.Login = instance.web.OldWidget.extend({
template: "Login",
@@ -103,7 +103,7 @@ openerp.web_mobile.Login = openerp.web.OldWidget.extend({
.addClass("login_valid");
//.hide();
if(!$('#oe_menu').html().length){
- this.menu = new openerp.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu");
+ this.menu = new instance.web_mobile.Menu(this, "oe_menu", "oe_secondary_menu");
this.menu.start();
}else{
$.mobile.changePage("#oe_menu", "slide", false, true);
@@ -119,7 +119,7 @@ openerp.web_mobile.Login = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Header = openerp.web.OldWidget.extend({
+instance.web_mobile.Header = instance.web.OldWidget.extend({
template: "Header",
@@ -131,7 +131,7 @@ openerp.web_mobile.Header = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Footer = openerp.web.OldWidget.extend({
+instance.web_mobile.Footer = instance.web.OldWidget.extend({
template: "Footer",
@@ -143,7 +143,7 @@ openerp.web_mobile.Footer = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({
+instance.web_mobile.Shortcuts = instance.web.OldWidget.extend({
template: "Shortcuts",
@@ -171,7 +171,7 @@ openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({
res_id = $shortcut.data('res');
if(!$('[id^="oe_list_'+res_id+'"]').html()){
$('<div id="oe_list_'+res_id+'" data-role="page" data-url="oe_list_'+res_id+'"> </div>').appendTo('#moe');
- this.listview = new openerp.web_mobile.ListView(self, "oe_list_"+res_id, res_id);
+ this.listview = new instance.web_mobile.ListView(self, "oe_list_"+res_id, res_id);
this.listview.start();
}else{
$.mobile.changePage('#oe_list_'+res_id, "slide", false, true);
@@ -182,7 +182,7 @@ openerp.web_mobile.Shortcuts = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Menu = openerp.web.OldWidget.extend({
+instance.web_mobile.Menu = instance.web.OldWidget.extend({
template: "Menu",
@@ -199,16 +199,16 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({
on_loaded: function(data) {
var self = this;
this.data = data;
- this.header = new openerp.web_mobile.Header(this, "oe_header");
+ this.header = new instance.web_mobile.Header(this, "oe_header");
this.header.start();
- this.footer = new openerp.web_mobile.Footer(this, "oe_footer");
+ this.footer = new instance.web_mobile.Footer(this, "oe_footer");
this.footer.start();
this.$element.html(this.render(this.data));
this.$element.find("[data-role=header]").find('h1').html('Applications');
this.$element.find("[data-role=header]").find('#home').hide();
this.$element.find("[data-role=footer]").find('#shrotcuts').click(function(){
if(!$('#oe_shortcuts').html().length){
- this.shortcuts = new openerp.web_mobile.Shortcuts(self, "oe_shortcuts");
+ this.shortcuts = new instance.web_mobile.Shortcuts(self, "oe_shortcuts");
this.shortcuts.start();
}else{
$.mobile.changePage($("#oe_shortcuts"), "slide", false, true);
@@ -216,7 +216,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({
});
this.$element.find("[data-role=footer]").find('#preference').click(function(){
if(!$('#oe_options').html().length){
- this.options = new openerp.web_mobile.Options(self, "oe_options");
+ this.options = new instance.web_mobile.Options(self, "oe_options");
this.options.start();
}else{
$.mobile.changePage("#oe_options", "slide", false, true);
@@ -240,7 +240,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({
.addClass("secondary_menu");
if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
$('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
- this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
+ this.secondary = new instance.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
this.secondary.start();
}else{
$.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true);
@@ -248,7 +248,7 @@ openerp.web_mobile.Menu = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({
+instance.web_mobile.Secondary = instance.web.OldWidget.extend({
template: "Menu.secondary",
@@ -287,7 +287,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({
.addClass("secondary_menu");
if(!$('[id^="oe_sec_menu_'+id+'"]').html()){
$('<div id="oe_sec_menu_'+id+'" data-role="page" data-url="oe_sec_menu_'+id+'"> </div>').appendTo('#moe');
- this.secondary = new openerp.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
+ this.secondary = new instance.web_mobile.Secondary(this, "oe_sec_menu_"+id, this.children);
this.secondary.start();
}else{
$.mobile.changePage('#oe_sec_menu_'+id, "slide", false, true);
@@ -295,7 +295,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({
}else {
if(!$('[id^="oe_list_'+id+'"]').html()){
$('<div id="oe_list_'+id+'" data-role="page" data-url="oe_list_'+id+'"> </div>').appendTo('#moe');
- this.listview = new openerp.web_mobile.ListView(this, "oe_list_"+id, id);
+ this.listview = new instance.web_mobile.ListView(this, "oe_list_"+id, id);
this.listview.start();
}else{
$.mobile.changePage('#oe_list_'+id, "slide", false, true);
@@ -305,7 +305,7 @@ openerp.web_mobile.Secondary = openerp.web.OldWidget.extend({
}
});
-openerp.web_mobile.Options = openerp.web.OldWidget.extend({
+instance.web_mobile.Options = instance.web.OldWidget.extend({
template: "Options",
diff --git a/addons/web_mobile/static/src/js/form_mobile.js b/addons/web_mobile/static/src/js/form_mobile.js
index cf44cca1879..c3c2025ac1f 100644
--- a/addons/web_mobile/static/src/js/form_mobile.js
+++ b/addons/web_mobile/static/src/js/form_mobile.js
@@ -2,9 +2,9 @@
* OpenERP Web Mobile Form View
*---------------------------------------------------------*/
-openerp.web_mobile.form_mobile = function (openerp) {
+openerp.web_mobile.form_mobile = function (instance) {
-openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
+instance.web_mobile.FormView = instance.web.OldWidget.extend({
template: 'FormView',
@@ -25,8 +25,8 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
}else{
var view_id = this.viewid;
}
- this.dataset = new openerp.web.DataSetSearch(this, model, null, null);
- var context = new openerp.web.CompoundContext(this.dataset.get_context());
+ this.dataset = new instance.web.DataSetSearch(this, model, null, null);
+ var context = new instance.web.CompoundContext(this.dataset.get_context());
this.dataset.read_slice([]).then(function (result) {
for (var i = 0; i < result.length; i++) {
if (result[i].id == id) {
@@ -71,14 +71,14 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
var head = rel_field.string;
if (rel_ids) {
var list_ids = [];
- var datasearch = new openerp.web.DataSetSearch(self, rel_field.relation, rel_field.context);
+ var datasearch = new instance.web.DataSetSearch(self, rel_field.relation, rel_field.context);
datasearch.domain=[['id', 'in', rel_ids]];
datasearch.read_slice(['name'], {context:rel_field.context, domain: datasearch.domain, limit:80}).then(function(listrec){
_.each(listrec, function(i) {
list_ids.push(i.id);
});
_.extend(rel_field.context,{"html_name_get" : true});
- var dataset = new openerp.web.DataSet(self, rel_field.relation,rel_field.context);
+ var dataset = new instance.web.DataSet(self, rel_field.relation,rel_field.context);
dataset.name_get(list_ids,function(res){
var additional = "";
if(res['html_name_get']){
@@ -86,7 +86,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
}
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(openerp.web.qweb.render("ListView", {'records' : res,'data': additional}));
+ $('[id^="oe_list_'+relational+'_'+self.element_id+'"]').html(instance.web.qweb.render("ListView", {'records' : res,'data': additional}));
$('[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);
@@ -98,7 +98,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
var listid = $(ev.currentTarget).data('id');
if(!$('[id^="oe_form_'+listid+rel_field.relation+'"]').html()){
$('<div id="oe_form_'+listid+rel_field.relation+'" data-role="page" data-url="oe_form_'+listid+rel_field.relation+'"> </div>').appendTo('#moe');
- this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+listid+rel_field.relation, listid, '', head, rel_field.relation, false);
+ this.formview = new instance.web_mobile.FormView(self, "oe_form_"+listid+rel_field.relation, listid, '', head, rel_field.relation, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+listid+rel_field.relation, "slide", false, true);
@@ -126,7 +126,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
if(selected_id){
if(!$('[id^="oe_form_'+selected_id+select_model+'"]').html()){
$('<div id="oe_form_'+selected_id+select_model+'" data-role="page" data-url="oe_form_'+selected_id+select_model+'"> </div>').appendTo('#moe');
- this.formview = new openerp.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
+ this.formview = new instance.web_mobile.FormView(self, "oe_form_"+selected_id+select_model, selected_id, '', head, select_model, false);
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+selected_id+select_model, "slide", false, true);
@@ -168,7 +168,7 @@ openerp.web_mobile.FormView = openerp.web.OldWidget.extend({
// Temp: Set as disabled
$("#"+getfields[i].attrs.name).attr('disabled', 'true');
if(result.fields[getfields[i].attrs.name]){
- var dateresult = openerp.web.format_value(data[getfields[i].attrs.name], {"widget": result.fields[getfields[i].attrs.name].type});
+ var dateresult = instance.web.format_value(data[getfields[i].attrs.name], {"widget": result.fields[getfields[i].attrs.name].type});
$(this).val(dateresult);
}
}
diff --git a/addons/web_mobile/static/src/js/list_mobile.js b/addons/web_mobile/static/src/js/list_mobile.js
index 16296df59e7..abe5620a0a3 100644
--- a/addons/web_mobile/static/src/js/list_mobile.js
+++ b/addons/web_mobile/static/src/js/list_mobile.js
@@ -2,9 +2,9 @@
* OpenERP Web Mobile List View
*---------------------------------------------------------*/
-openerp.web_mobile.list_mobile = function (openerp) {
+openerp.web_mobile.list_mobile = function (instance) {
-openerp.web_mobile.ListView = openerp.web.OldWidget.extend({
+instance.web_mobile.ListView = instance.web.OldWidget.extend({
template: 'ListView',
@@ -31,14 +31,14 @@ openerp.web_mobile.ListView = openerp.web.OldWidget.extend({
on_search_data: function(ev){
var self = this;
var list_ids = [];
- var datasearch = new openerp.web.DataSetSearch(self, self.action.res_model,self.action.context);
+ var datasearch = new instance.web.DataSetSearch(self, self.action.res_model,self.action.context);
datasearch.domain = self.action.domain;
datasearch.read_slice(['name'], {context:datasearch.context, domain: datasearch.domain, limit:80}).then(function(listresult){
_.each(listresult, function(i) {
list_ids.push(i.id);
});
_.extend(self.action.context,{"html_name_get" : true});
- var dataset = new openerp.web.DataSet(self, datasearch.model,datasearch.context);
+ var dataset = new instance.web.DataSet(self, datasearch.model,datasearch.context);
dataset.name_get(list_ids,function(res){
var additional = "";
if(res['html_name_get']){
@@ -64,7 +64,7 @@ openerp.web_mobile.ListView = openerp.web.OldWidget.extend({
head_title = $.trim($record.text());
if(!$('[id^="oe_form_'+id+this.action.res_model+'"]').html()){
$('<div id="oe_form_'+id+this.action.res_model+'" data-role="page" data-url="oe_form_'+id+this.action.res_model+'"> </div>').appendTo('#moe');
- this.formview = new openerp.web_mobile.FormView(this, "oe_form_"+id+this.action.res_model, id, this.action, head_title, '' ,'');
+ this.formview = new instance.web_mobile.FormView(this, "oe_form_"+id+this.action.res_model, id, this.action, head_title, '' ,'');
this.formview.start();
}else{
$.mobile.changePage('#oe_form_'+id+this.action.res_model, "slide", false, true);