[WIP] point_of_sale: don't auto bottom scroll if not at bottom + saner css
authorFrédéric van der Essen <fva@openerp.com>
Wed, 9 Oct 2013 14:57:17 +0000 (16:57 +0200)
committerFrédéric van der Essen <fva@openerp.com>
Wed, 9 Oct 2013 14:57:17 +0000 (16:57 +0200)
bzr revid: fva@openerp.com-20131009145717-n42jt76nig0poc2n

addons/point_of_sale/static/src/css/pos.css
addons/point_of_sale/static/src/js/widgets.js

index ff4b5d1..5a2cd74 100644 (file)
     -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
 }
 
+.point-of-sale button{
+    box-shadow: none;
+    outline: none;
+    border: none;
+}
+.point-of-sale button:hover{
+    background: default;
+}
+
 .point-of-sale .oe_hidden{
     display: none !important;
 }
     font-weight: bold;
     vertical-align: middle;
     color: #555555;
-    border-top: 1px solid #efefef;
     font-size: 14px;
 }
 .point-of-sale #paypad button:active, 
     font-weight: bold;
     vertical-align: middle;
     color: #555555;
-    border-top: 1px solid #efefef;
 }
 .point-of-sale .input-button {
     font-size: 24px;
 .point-of-sale #categories {
     /*background:#f0f0f0;*/
     position: relative;
-    border-bottom: 2px solid #e0e0e0;
+    border-bottom: 1px solid #cecece;
 }
 .point-of-sale #categories .white-gradient{
     position: absolute;
     width: 120px;
     height:120px;
     background:#fff;
-    border: 1px solid #fff;
+    border: 1px solid #e2e2e2;
+    border-radius: 3px;
+    border-bottom-width: 3px;
     cursor: pointer;
 }
 
     width: 120px;
     height:120px;
     background:#fff;
-    border: 1px solid #fff;
+    border: 1px solid #e2e2e2;
+    border-radius: 3px;
+    border-bottom-width: 3px;
     overflow: hidden;
 }
 
     margin-top: 50px;
     padding: 40px;
     background-color: #f8f8f8;
+    border: solid 1px rgb(220,220,220);
 }
 .point-of-sale .pos-payment-container .left-block{
     display: inline-block;
     margin-right: auto;
     padding: 40px;
     background: #f1f1f1;
+    border-top: 1px solid #efefef;
 }
 
 .point-of-sale .scale-screen .product-picture {
     margin-top:16px;
     margin-bottom:16px;
     font-size:16px;
-
+    border-radius: 3px;
+    border: solid 1px rgb(220,220,220);
 }
 
 .point-of-sale .order .empty{
     line-height:180px;
 }
 
+/*  ********* The Webkit Scrollbar  ********* */
+
+.point-of-sale *::-webkit-scrollbar{
+    width:  10px;
+    height: 10px;
+}
+.point-of-sale *::-webkit-scrollbar-track{
+    background: rgb(224,224,224);
+    border-left: solid 1px rgb(200,200,200);
+}
+.point-of-sale *::-webkit-scrollbar-thumb{
+    background: rgb(168,168,168);
+    min-height: 30px;
+}
+
 /*  ********* The ScrollBarWidget  ********* */
 
 .point-of-sale .scrollbar{  
index fa455fc..1abd6c3 100644 (file)
@@ -200,7 +200,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
         },
         bind_orderline_events: function() {
             this.currentOrderLines = (this.pos.get('selectedOrder')).get('orderLines');
-            this.currentOrderLines.bind('add', this.renderElement, this);
+            this.currentOrderLines.bind('add', function(){ this.renderElement(true);}, this);
             this.currentOrderLines.bind('remove', this.renderElement, this);
         },
         update_numpad: function() {
@@ -208,14 +208,15 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
             if (this.numpadState)
                 this.numpadState.reset();
         },
-        renderElement: function() {
+        renderElement: function(goto_bottom) {
             var self = this;
             var scroller = this.$('.order-scroller')[0];
             var scrollbottom = true;
+            var scrollTop = 0;
             if(scroller){
                 var overflow_bottom = scroller.scrollHeight - scroller.clientHeight;
-                var scrollTop = scroller.scrollTop;
-                if( scrollTop < 0.9 * overflow_bottom){
+                scrollTop = scroller.scrollTop;
+                if( !goto_bottom && scrollTop < 0.9 * overflow_bottom){
                     scrollbottom = false;
                 }
             }
@@ -251,8 +252,12 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
             this.update_summary();
 
             scroller = this.$('.order-scroller')[0];
-            if(scroller && scrollbottom){
-                scroller.scrollTop = scroller.scrollHeight - scroller.clientHeight;
+            if(scroller){
+                if(scrollbottom){
+                    scroller.scrollTop = scroller.scrollHeight - scroller.clientHeight;
+                }else{
+                    scroller.scrollTop = scrollTop;
+                }
             }
         },
         update_summary: function(){