[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
This commit is contained in:
Gery Debongnie 2014-03-19 09:57:18 +01:00
parent 373cb908ca
commit f4cfed3f0e
4 changed files with 29 additions and 12 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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 && "<span class=\"fa " + node.attrs.icon + "\"></span>";
this.icon = node.attrs.icon && "<span class=\"fa " + node.attrs.icon + " fa-fw\"></span>";
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));
},
});

View File

@ -1362,7 +1362,7 @@
t-att-autofocus="widget.node.attrs.autofocus"
t-att-accesskey="widget.node.attrs.accesskey">
<img t-if="!widget.is_stat_button and widget.node.attrs.icon " t-att-src="_s + widget.node.attrs.icon" width="16" height="16"/>
<div t-if="widget.is_stat_button and widget.icon" class="stat_button_icon"><t t-raw="widget.icon"/></div>
<div t-if="widget.is_stat_button" class="stat_button_icon"><t t-if="widget.icon" t-raw="widget.icon"/></div>
<span t-if="widget.string and !widget.is_stat_button"><t t-esc="widget.string"/></span>
<div t-if="widget.string and widget.is_stat_button"><t t-esc="widget.string"/></div>
</button>
@ -1937,6 +1937,5 @@
<a href="javascript:void(0)"><t t-esc="text"/></a>
</t>
<t t-name="StatInfo">
<div><t t-esc="text"/></div>
</t>
<strong><t t-esc="value"/></strong><br/><t t-esc="text"/></t>
</templates>