mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Add README.rst Too short underline for module title in README.rst Improving module meta information Version 1.0 W391 blank line at end of file Remove module description because README.rst is there web_search_with_and: Latest OCA conventions
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
openerp.web_search_with_and = function (instance) {
|
|
|
|
instance.web.SearchView = instance.web.SearchView.extend({
|
|
select_completion: function (e, ui) {
|
|
var self = this;
|
|
if (e.shiftKey) {
|
|
e.preventDefault();
|
|
|
|
var input_index = _(this.input_subviews).indexOf(
|
|
this.subviewForRoot(
|
|
this.$('div.oe_searchview_input:focus')[0]));
|
|
this.query.add(ui.item.facet, {at: input_index / 2, shiftKey: true});
|
|
} else {
|
|
this._super(e, ui);
|
|
}
|
|
},
|
|
});
|
|
|
|
instance.web.search.SearchQuery = instance.web.search.SearchQuery.extend({
|
|
add: function (values, options) {
|
|
|
|
options = options || {};
|
|
|
|
if (!values) {
|
|
values = [];
|
|
} else if (!(values instanceof Array)) {
|
|
values = [values];
|
|
}
|
|
|
|
if (options.shiftKey) {
|
|
delete options.shiftKey;
|
|
_(values).each(function (value) {
|
|
var model = this._prepareModel(value, options);
|
|
Backbone.Collection.prototype.add.call(this, model, options);
|
|
}, this);
|
|
return this;
|
|
}
|
|
else {
|
|
return this.constructor.__super__.add.apply(this, arguments);
|
|
}
|
|
},
|
|
});
|
|
};
|