-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[8.0][ADD] web_search_nospace: remove redundant spaces when pasting content into search box #660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey @daramousk, thank you for your Pull Request. It looks like some users haven't signed our Contributor License Agreement, yet.
Appreciation of efforts, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you painted the icon yourself, add its source too, if not, add a reference to where you got it and check that it has a free license in the first place
| * (http://www.gnu.org/licenses/agpl.html). | ||
| */ | ||
| openerp.web_search_nospace = function(instance) { | ||
| instance.web.search.InputView = instance.web.search.InputView.extend({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't do this. This way, you actually replace the InputView object, this can cause very hard to debug problems. Say use include instead, this modifies the existing object
web_search_nospace/__openerp__.py
Outdated
| This module trims the whitespace from the search bar in the end of your | ||
| search term. | ||
| """, | ||
| 'version': "1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@hbrunn Implemented the changes |
|
@NL66278 A review here as well would be nice. |
| @@ -0,0 +1,16 @@ | |||
| /** | |||
| * © 2017 Therp BV <http://therp.nl> License AGPL-3.0 or later | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it the full word Copyright. and use https://
| openerp.web_search_nospace = function(instance) { | ||
| instance.web.search.InputView.include({ | ||
|
|
||
| onPaste : function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the large indents? Another :retab needed?
|
|
||
| onPaste : function() { | ||
| this._super() | ||
| setTimeout(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not an expert in Odoo javascript programming. But is the timeout really needed here? Can't we have simply: this.$el.text(this.$el.text().trim()); directly? Just asking...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daramousk Please answer this question as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NL66278 Basically there were some timing/race condition issues from what I remember, you can see an explanation here https://stackoverflow.com/questions/779379/why-is-settimeoutfn-0-sometimes-useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daramousk Did you actually experience these conditions? Because if I read up on the discussion on stackoverflow, especially the extended answer by DVK, this does not seem to apply here, but maybe I am mistaken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NL66278 Ok I just went back to this to remember why I used it. Basically I used it because it was used on the super call and for some reason the the changes to $el are not propagated unless you force it with setTimeout. If you remove the setTimeout the whole thing will not work at all.
Now why this happens I do not know, it's probably some obscure event handling mechanism. You can check the super call for more data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, lets keep it as you made it.
| <?xml version="1.0" encoding="utf-8"?> | ||
| <openerp> | ||
| <data> | ||
| <template id="assets_backend" name="web_search_nospace.assets_backend" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More indentation problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG, just minor changes required
web_search_nospace/README.rst
Outdated
| @@ -0,0 +1,40 @@ | |||
| .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as this is a new module pls follow the new readme structure https://github.com/OCA/maintainer-tools/tree/master/template/module/readme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simahawk Doesn't this readme follow the new structure? (some non necessary sections are omitted)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you follow the link you see that the README.rst is not there anymore and is auto-generated w/ per-section files from /readme.
I don't see the dir so.... nope :)
web_search_nospace/__init__.py
Outdated
| @@ -0,0 +1,3 @@ | |||
| # -*- coding: utf-8 -*- | |||
| # © 2017 Therp BV <http://therp.nl> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy is not needed in __init__, no mandatory to remove tho... but pls, replace ©️ w/ "Coypright"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor change
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| { | ||
| 'name': "Search no space", | ||
| 'author': "Therp BV, Odoo Community Association (OCA)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@daramousk Add a website key as per this
1f57dc5 to
147b321
Compare
f487cda to
d19881e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM. Please still remove last copyright symbol. Not blocking though. For the rest OK.
d19881e to
a6167a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you take a look at the lint issues https://travis-ci.org/OCA/web/jobs/480883417#L1686
|
@tarteo These lint errors are from a totally different module. |
|
@NL66278 Oops, I meant https://travis-ci.org/OCA/web/jobs/480883417#L1822 |
|
@simahawk Simone, anything else that needs to be done here? |
88196a0 to
bed767a
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
When you paste content in the search bar that has whitespace characters before or after the search string thus causing the search to fail.
This module fixes that