From f4cfed3f0e89f8841b16ad578dd2c360f01d18ec Mon Sep 17 00:00:00 2001 From: Gery Debongnie Date: Wed, 19 Mar 2014 09:57:18 +0100 Subject: [PATCH] [IMP] improves the look of the stat buttons in form view: the statinfo widget displays the information on two lines, the padding/margin/width have been adjusted. (addon web) bzr revid: ged@openerp.com-20140319085718-9v1l3pb43ee6qws6 --- addons/web/static/src/css/base.css | 14 +++++++++++--- addons/web/static/src/css/base.sass | 13 ++++++++++--- addons/web/static/src/js/view_form.js | 9 ++++++--- addons/web/static/src/xml/base.xml | 5 ++--- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 1d843e7e250..53043f2f4c5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -461,16 +461,22 @@ text-align: left; } .openerp .oe_button_box .oe_stat_button:hover { - background: #dddddd; + background: #7c7bad; + color: white; +} +.openerp .oe_button_box .oe_stat_button:hover .fa { + color: white; } .openerp .oe_button_box .oe_stat_button { font-weight: normal; display: inline-table; width: 33% !important; - height: 45px; + height: 42px; margin: 0px -1px -1px 0px; + padding: 0; color: #666666; - border: 1px solid #666666; + border: 1px solid #dddddd; + border-radius: 0; background: white; } .openerp .oe_button_box .oe_stat_button > div { @@ -478,11 +484,13 @@ vertical-align: middle; text-align: left; padding: 0; + line-height: 120%; } .openerp .oe_button_box .oe_stat_button .stat_button_icon { color: #7c7bad; font-size: 24px; padding: 0px 3px; + width: 37px; text-align: center; } .openerp .oe_button_box .oe_stat_button svg { diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index cca0deb4a1f..466f60fa861 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -433,25 +433,32 @@ $sheet-padding: 16px width: 400px text-align: left .oe_stat_button:hover - background: #ddd + background: #7c7bad + color: white + .fa + color: white .oe_stat_button font-weight: normal display: inline-table width: 33% !important - height: 45px + height: 42px margin: 0px -1px -1px 0px + padding: 0 color: #666 - border: 1px solid #666 + border: 1px solid #dddddd + border-radius: 0 background: white > div display: table-cell vertical-align: middle text-align: left padding: 0 + line-height: 120% .stat_button_icon color: #7C7BAD font-size: 24px padding: 0px 3px + width: 37px text-align: center svg width: 38px diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 969e0150737..5840d718bf8 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1917,7 +1917,7 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ init: function(field_manager, node) { node.attrs.type = node.attrs['data-button-type']; this.is_stat_button = /\boe_stat_button\b/.test(node.attrs['class']); - this.icon = node.attrs.icon && ""; + this.icon = node.attrs.icon && ""; this._super(field_manager, node); this.force_disabled = false; this.string = (this.node.attrs.string || '').replace(/_/g, ''); @@ -5918,8 +5918,11 @@ instance.web.form.StatInfo = instance.web.form.AbstractField.extend({ this.set("value", 0); }, render_value: function() { - var text = _.str.sprintf("%d %s", this.get("value") || 0, this.string); - this.$el.html(QWeb.render("StatInfo", {text: text})); + var options = { + value: this.get("value") || 0, + text: this.string, + }; + this.$el.html(QWeb.render("StatInfo", options)); }, }); diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 508c507d935..e35d0c977b3 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1362,7 +1362,7 @@ t-att-autofocus="widget.node.attrs.autofocus" t-att-accesskey="widget.node.attrs.accesskey"> -
+
@@ -1937,6 +1937,5 @@ -
-
+