[IMP] Extended filters wip.
bzr revid: nicolas.vanhoren@openerp.com-20110328124247-mb723pentlpimb1z
This commit is contained in:
parent
cf4fda9764
commit
5b477c1464
|
@ -13,6 +13,7 @@
|
|||
<script type="text/javascript" src="/base/static/LABjs/LAB.js"></script>
|
||||
<script>
|
||||
$LAB
|
||||
.setOptions({UsePreloading:false})
|
||||
.script('/base/static/openerp/js/base.js')
|
||||
.script('/base/static/qweb/qweb.js')
|
||||
.script('/base/static/underscore/underscore.js')
|
||||
|
|
|
@ -370,8 +370,24 @@
|
|||
<t t-set="expand" t-value="false"/>
|
||||
<t t-set="label" t-value="'Extended Filters'"/>
|
||||
<t t-set="content">
|
||||
This is the extended search view placeholder.
|
||||
<div class="searchview_extended_groups_list"></div>
|
||||
<button class="searchview_extended_add_group">Add group of conditions</button>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="SearchView.extended_search.group">
|
||||
<div t-att-id="element_id">
|
||||
<select>
|
||||
<option value="all">All</option>
|
||||
<option value="any">Any</option>
|
||||
<option value="none">None</option>
|
||||
</select>
|
||||
<div class="searchview_extended_propositions_list">
|
||||
</div>
|
||||
<button class="searchview_extended_add_proposition">Add Proposition</button>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="SearchView.extended_search.proposition">
|
||||
Placeholder
|
||||
</t>
|
||||
</templates>
|
||||
|
|
|
@ -515,7 +515,7 @@ openerp.base.SearchView = openerp.base.Controller.extend({
|
|||
data.fields_view.fields);
|
||||
|
||||
// for extended search view
|
||||
lines.push([new openerp.base.search.ExtendedSearch(this)]);
|
||||
lines.push([new openerp.base.search.ExtendedSearch(this, data.fields_view.fields)]);
|
||||
|
||||
var render = QWeb.render("SearchView", {
|
||||
'view': data.fields_view['arch'],
|
||||
|
@ -746,14 +746,72 @@ openerp.base.search.Group = openerp.base.search.Widget.extend({
|
|||
});
|
||||
openerp.base.search.ExtendedSearch = openerp.base.search.Widget.extend({
|
||||
template: 'SearchView.extended_search',
|
||||
init: function (view) {
|
||||
init: function (view, fields) {
|
||||
this._super(view);
|
||||
this.make_id('extended-search');
|
||||
this.fields = fields;
|
||||
this.groups_list = [];
|
||||
},
|
||||
add_group: function(group) {
|
||||
var group = new openerp.base.search.ExtendedSearchGroup(this.view, this.fields);
|
||||
var $root = this.$element;
|
||||
this.groups_list.push(group);
|
||||
var render = group.render({});
|
||||
var groups_div = $root.find('.searchview_extended_groups_list');
|
||||
groups_div.html(groups_div.html() + render);
|
||||
group.start();
|
||||
},
|
||||
start: function () {
|
||||
this._super();
|
||||
var $root = this.$element;
|
||||
add_expand_listener(this.$element);
|
||||
var $this = this;
|
||||
add_expand_listener($root);
|
||||
this.add_group();
|
||||
$root.find('.searchview_extended_add_group').click(function (e) {
|
||||
$this.add_group()
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
});
|
||||
openerp.base.search.ExtendedSearchGroup = openerp.base.search.Widget.extend({
|
||||
template: 'SearchView.extended_search.group',
|
||||
init: function (view, fields) {
|
||||
this._super(view);
|
||||
this.make_id('extended-search-group');
|
||||
this.attrs = {fields: fields};
|
||||
this.propositions_list = [];
|
||||
},
|
||||
add_prop: function() {
|
||||
var $root = this.$element;
|
||||
var prop = new openerp.base.search.ExtendedSearchProposition(this.view, this.fields);
|
||||
this.propositions_list.push(prop);
|
||||
var render = prop.render({});
|
||||
var propositions_div = $root.find('.searchview_extended_propositions_list');
|
||||
propositions_div.html(propositions_div.html() + render);
|
||||
prop.start();
|
||||
},
|
||||
start: function () {
|
||||
this._super();
|
||||
var $root = this.$element;
|
||||
var $this = this;
|
||||
this.add_prop();
|
||||
$root.find('.searchview_extended_add_proposition').click(function (e) {
|
||||
$this.add_prop();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
}
|
||||
});
|
||||
openerp.base.search.ExtendedSearchProposition = openerp.base.search.Widget.extend({
|
||||
template: 'SearchView.extended_search.proposition',
|
||||
init: function (view, fields) {
|
||||
this._super(view);
|
||||
this.make_id('extended-search-proposition');
|
||||
this.attrs = {fields: fields};
|
||||
},
|
||||
start: function () {
|
||||
this._super();
|
||||
}
|
||||
});
|
||||
openerp.base.search.Input = openerp.base.search.Widget.extend({
|
||||
|
|
Loading…
Reference in New Issue