[ADD] icons instead of category names for filters (and groupby filters)
bzr revid: xmo@openerp.com-20120504095717-va123l3gz3wvhjd1
This commit is contained in:
parent
7e0bd0103b
commit
84cae313d2
|
@ -869,6 +869,7 @@ instance.web.search.Input = instance.web.search.Widget.extend( /** @lends instan
|
||||||
});
|
});
|
||||||
instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends instance.web.search.FilterGroup# */{
|
instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends instance.web.search.FilterGroup# */{
|
||||||
template: 'SearchView.filters',
|
template: 'SearchView.filters',
|
||||||
|
icon: 'q',
|
||||||
/**
|
/**
|
||||||
* Inclusive group of filters, creates a continuous "button" with clickable
|
* Inclusive group of filters, creates a continuous "button" with clickable
|
||||||
* sections (the normal display for filters is to be a self-contained button)
|
* sections (the normal display for filters is to be a self-contained button)
|
||||||
|
@ -897,6 +898,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
|
||||||
make_facet: function (values) {
|
make_facet: function (values) {
|
||||||
return {
|
return {
|
||||||
category: _t("Filter"),
|
category: _t("Filter"),
|
||||||
|
icon: this.icon,
|
||||||
values: values,
|
values: values,
|
||||||
field: this
|
field: this
|
||||||
}
|
}
|
||||||
|
@ -974,6 +976,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
|
instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
|
||||||
|
icon: 'w',
|
||||||
init: function (filters, view) {
|
init: function (filters, view) {
|
||||||
this._super(filters, view);
|
this._super(filters, view);
|
||||||
// Not flanders: facet unicity is handled through the
|
// Not flanders: facet unicity is handled through the
|
||||||
|
@ -995,6 +998,7 @@ instance.web.search.GroupbyGroup = instance.web.search.FilterGroup.extend({
|
||||||
make_facet: function (values) {
|
make_facet: function (values) {
|
||||||
return {
|
return {
|
||||||
category: _t("GroupBy"),
|
category: _t("GroupBy"),
|
||||||
|
icon: this.icon,
|
||||||
values: values,
|
values: values,
|
||||||
field: this.getParent()._s_groupby
|
field: this.getParent()._s_groupby
|
||||||
};
|
};
|
||||||
|
|
|
@ -1303,7 +1303,11 @@
|
||||||
type="button"
|
type="button"
|
||||||
class="oe_searchview_facet">
|
class="oe_searchview_facet">
|
||||||
<span class="oe_facet_remove">✖</span>
|
<span class="oe_facet_remove">✖</span>
|
||||||
<span class="oe_facet_category">
|
|
||||||
|
<span class="oe_facet_category oe_i" t-if="widget.model.has('icon')">
|
||||||
|
<t t-esc="widget.model.get('icon')"/>
|
||||||
|
</span
|
||||||
|
><span class="oe_facet_category" t-if="!widget.model.has('icon')">
|
||||||
<t t-esc="widget.model.get('category')"/>
|
<t t-esc="widget.model.get('category')"/>
|
||||||
</span ><span/>
|
</span ><span/>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -218,6 +218,17 @@ with directly by external objects or search view controls
|
||||||
it serializes to and deserializes from javascript arrays (via
|
it serializes to and deserializes from javascript arrays (via
|
||||||
``Collection#toJSON`` and ``Collection#reset``).
|
``Collection#toJSON`` and ``Collection#reset``).
|
||||||
|
|
||||||
|
.. js:attribute:: [icon]
|
||||||
|
|
||||||
|
optional, a single ASCII letter (a-z or A-Z) mapping to the
|
||||||
|
bundled mnmliconsRegular icon font.
|
||||||
|
|
||||||
|
When a facet with an ``icon`` attribute is rendered, the icon
|
||||||
|
is displayed (in the icon font) in the first section of the
|
||||||
|
facet instead of the ``category``.
|
||||||
|
|
||||||
|
By default, only filters make use of this facility.
|
||||||
|
|
||||||
.. js:class:: openerp.web.search.FacetValues
|
.. js:class:: openerp.web.search.FacetValues
|
||||||
|
|
||||||
`Backbone collection`_ of
|
`Backbone collection`_ of
|
||||||
|
|
Loading…
Reference in New Issue