[REF] web: relational fields: FieldStatus

Moves back the mobile rendering part of the FieldStatus to
enterprise, alongside all other tweaks to improve the UX in mobile.

This part had been moved to community inadvertendly in the new
views branch.
This commit is contained in:
Aaron Bohy
2017-04-27 15:53:16 +02:00
parent dd6a071dbf
commit 7dab370a06
2 changed files with 9 additions and 27 deletions
@@ -1507,22 +1507,14 @@ var FieldStatus = AbstractField.extend({
* @private
*/
_render: function () {
if (config.device.size_class > config.device.SIZES.XS) {
var selections = _.partition(this.status_information, function (info) {
return (info.selected || !info.fold);
});
this.$el.html(qweb.render("FieldStatus.content.desktop", {
selection_unfolded: selections[0],
selection_folded: selections[1],
clickable: !!this.attrs.clickable,
}));
} else {
this.$el.html(qweb.render("FieldStatus.content.mobile", {
selection: this.status_information,
value: _.findWhere(this.status_information, {selected: true}).display_name,
clickable: !!this.attrs.clickable,
}));
}
var selections = _.partition(this.status_information, function (info) {
return (info.selected || !info.fold);
});
this.$el.html(qweb.render("FieldStatus.content", {
selection_unfolded: selections[0],
selection_folded: selections[1],
clickable: !!this.attrs.clickable,
}));
},
//--------------------------------------------------------------------------
+1 -11
View File
@@ -945,7 +945,7 @@
<span t-if="widget.string"><t t-esc="widget.string"/></span>
</div>
</t>
<t t-name="FieldStatus.content.desktop">
<t t-name="FieldStatus.content">
<t t-if="selection_folded.length">
<ul class="dropdown-menu o-status-more" role="menu">
<li t-foreach="selection_folded" t-as="i">
@@ -958,16 +958,6 @@
<t t-call="FieldStatus.content.button"/>
</t>
</t>
<t t-name="FieldStatus.content.mobile">
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown">
<t t-esc="value"/>
</button>
<ul class="dropdown-menu o-status-more" role="menu">
<li t-foreach="selection" t-as="i">
<t t-call="FieldStatus.content.button"/>
</li>
</ul>
</t>
<t t-name="FieldStatus.content.button">
<t t-set="disabled" t-value="!clickable || i.selected"/>
<button type="button" t-att-data-value="i.id" t-att-disabled="disabled ? 'disabled' : undefined"