changeset d511b46deff1 in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=d511b46deff1
description:
        Use small button in tree view

        This avoids to use negative margin to keep row heigh constant.
        And we display the button as block on responsive tree to make it easier 
to
        click on.

        issue8761
        review286171004
diffstat:

 src/common.js    |  4 ++--
 src/sao.less     |  8 ++++++--
 src/view/tree.js |  2 +-
 3 files changed, 9 insertions(+), 5 deletions(-)

diffs (58 lines):

diff -r deafb0b64c11 -r d511b46deff1 src/common.js
--- a/src/common.js     Thu Oct 24 19:17:29 2019 +0200
+++ b/src/common.js     Wed Oct 30 14:06:51 2019 +0100
@@ -758,7 +758,7 @@
     };
 
     Sao.common.Button = Sao.class_(Object, {
-        init: function(attributes, el) {
+        init: function(attributes, el, size) {
             this.attributes = attributes;
             if (el) {
                 this.el = el;
@@ -778,7 +778,7 @@
                 }).prependTo(this.el);
                 this.icon.hide();
             }
-            this.el.addClass('btn btn-default');
+            this.el.addClass('btn btn-default ' + size || '');
             this.el.attr('type', 'button');
             this.icon.attr('aria-hidden', true);
             this.set_icon(attributes.icon);
diff -r deafb0b64c11 -r d511b46deff1 src/sao.less
--- a/src/sao.less      Thu Oct 24 19:17:29 2019 +0200
+++ b/src/sao.less      Wed Oct 30 14:06:51 2019 +0100
@@ -346,8 +346,6 @@
     .btn {
         padding-top: 0;
         padding-bottom: 0;
-        margin-top: -@table-condensed-cell-padding;
-        margin-bottom: -@table-condensed-cell-padding;
     }
 }
 
@@ -612,6 +610,12 @@
                 min-height: calc(@line-height-computed + 
@table-condensed-cell-padding);
                 display: block;
             }
+
+            .btn {
+                display: block;
+                width: 100%;
+                font-size: @font-size-base;
+            }
         }
 
         tfoot {
diff -r deafb0b64c11 -r d511b46deff1 src/view/tree.js
--- a/src/view/tree.js  Thu Oct 24 19:17:29 2019 +0200
+++ b/src/view/tree.js  Wed Oct 30 14:06:51 2019 +0100
@@ -2341,7 +2341,7 @@
             this.attributes = attributes;
         },
         render: function(record, el) {
-            var button = new Sao.common.Button(this.attributes, el);
+            var button = new Sao.common.Button(this.attributes, el, 'btn-sm');
             if (!el) {
                 button.el.click(
                         [record, button], this.button_clicked.bind(this));

Reply via email to