mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
Squash of 8 commits
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
This commit is contained in:
committed by
David Dufresne
parent
cbf0981f42
commit
e47ca7ed6f
43
web_search_with_and/static/src/js/search.js
Normal file
43
web_search_with_and/static/src/js/search.js
Normal file
@@ -0,0 +1,43 @@
|
||||
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);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user