[IMP] point_of_sale: stealth way to invoke the debug widget in normal mode
- Tapping the Odoo logo 6 times quickly invokes the debug widget. - In debug mode it is shown by default, and is displayed by clicking the Odoo logo once.
This commit is contained in:
@@ -157,13 +157,10 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
'print_receipt',
|
||||
'scale_read',
|
||||
],
|
||||
minimized: false,
|
||||
init: function(parent,options){
|
||||
this._super(parent,options);
|
||||
var self = this;
|
||||
|
||||
this.minimized = false;
|
||||
|
||||
// for dragging the debug widget around
|
||||
this.dragging = false;
|
||||
this.dragpos = {x:0, y:0};
|
||||
@@ -202,8 +199,24 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
event.stopPropagation();
|
||||
};
|
||||
},
|
||||
show: function() {
|
||||
var self = this;
|
||||
this.$el.css({opacity:0});
|
||||
this.$el.removeClass('oe_hidden');
|
||||
this.$el.animate({opacity:1},250,'swing');
|
||||
},
|
||||
hide: function() {
|
||||
var self = this;
|
||||
this.$el.animate({opacity:0,},250,'swing',function(){
|
||||
self.$el.addClass('oe_hidden');
|
||||
});
|
||||
},
|
||||
start: function(){
|
||||
var self = this;
|
||||
|
||||
if (this.pos.debug) {
|
||||
this.show();
|
||||
}
|
||||
|
||||
this.el.addEventListener('mouseleave', this.dragend_handler);
|
||||
this.el.addEventListener('mouseup', this.dragend_handler);
|
||||
@@ -215,14 +228,7 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
this.el.addEventListener('touchmove', this.dragmove_handler);
|
||||
|
||||
this.$('.toggle').click(function(){
|
||||
var content = self.$('.content');
|
||||
var bg = self.$el;
|
||||
if(!self.minimized){
|
||||
content.animate({'height':'0'},200);
|
||||
}else{
|
||||
content.css({'height':'auto'});
|
||||
}
|
||||
self.minimized = !self.minimized;
|
||||
self.hide();
|
||||
});
|
||||
this.$('.button.set_weight').click(function(){
|
||||
var kg = Number(self.$('input.weight').val());
|
||||
@@ -409,6 +415,9 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
this.chrome = this; // So that chrome's childs have chrome set automatically
|
||||
this.pos.gui = this.gui;
|
||||
|
||||
this.logo_click_time = 0;
|
||||
this.logo_click_count = 0;
|
||||
|
||||
this.widget = {}; // contains references to subwidgets instances
|
||||
|
||||
this.cleanup_dom();
|
||||
@@ -437,17 +446,42 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
},
|
||||
|
||||
build_chrome: function() {
|
||||
var self = this;
|
||||
FastClick.attach(document.body);
|
||||
|
||||
instance.webclient.set_content_full_screen(true);
|
||||
|
||||
this.renderElement();
|
||||
|
||||
this.$('.pos-logo').click(function(){
|
||||
self.click_logo();
|
||||
});
|
||||
|
||||
if(this.pos.config.iface_big_scrollbars){
|
||||
this.$el.addClass('big-scrollbars');
|
||||
}
|
||||
},
|
||||
|
||||
click_logo: function() {
|
||||
if (this.pos.debug) {
|
||||
this.widget.debug.show();
|
||||
} else {
|
||||
var time = (new Date()).getTime();
|
||||
var delay = 500;
|
||||
if (this.logo_click_time + 500 < time) {
|
||||
this.logo_click_time = time;
|
||||
this.logo_click_count = 1;
|
||||
} else {
|
||||
this.logo_click_time = time;
|
||||
this.logo_click_count += 1;
|
||||
if (this.logo_click_count >= 6) {
|
||||
this.logo_click_count = 0;
|
||||
this.widget.debug.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
disable_rubberbanding: function(){
|
||||
// prevent the pos body from being scrollable.
|
||||
document.body.addEventListener('touchmove',function(event){
|
||||
@@ -521,7 +555,6 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
loading_show: function(){
|
||||
this.$('.loader').removeClass('oe_hidden').animate({opacity:1},150,'swing');
|
||||
},
|
||||
|
||||
widgets: [
|
||||
{
|
||||
'name': 'order_selector',
|
||||
@@ -570,7 +603,6 @@ openerp.point_of_sale.load_chrome = function load_chrome(instance, module){ //mo
|
||||
'name': 'debug',
|
||||
'widget': module.DebugWidget,
|
||||
'append': '.pos-content',
|
||||
'condition': function(){ return this.pos.debug },
|
||||
},
|
||||
],
|
||||
|
||||
|
||||
@@ -1122,9 +1122,9 @@
|
||||
|
||||
|
||||
<t t-name="DebugWidget">
|
||||
<div class="debug-widget">
|
||||
<div class="debug-widget oe_hidden">
|
||||
<h1>Debug Window</h1>
|
||||
<div class="toggle">▾</div>
|
||||
<div class="toggle"><i class='fa fa-times' /></div>
|
||||
<div class="content">
|
||||
<p class="category">Electronic Scale</p>
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user