Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@daramousk
Copy link
Member

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

@oca-clabot
Copy link

Hey @daramousk, thank you for your Pull Request.

It looks like some users haven't signed our Contributor License Agreement, yet.
You can read and sign our full Contributor License Agreement here: http://odoo-community.org/page/website.cla
Here is a list of the users:

  • George Daramouskas (no github login found)

Appreciation of efforts,
OCA CLAbot

Copy link
Member

@hbrunn hbrunn left a 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({
Copy link
Member

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

This module trims the whitespace from the search bar in the end of your
search term.
""",
'version': "1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yajo yajo added this to the 8.0 milestone Jun 30, 2017
@daramousk
Copy link
Member Author

@hbrunn Implemented the changes

@daramousk
Copy link
Member Author

@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
Copy link
Contributor

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() {
Copy link
Contributor

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() {
Copy link
Contributor

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...

Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More indentation problems.

@simahawk simahawk changed the title [IMP] Fix redundant spaces when pasting content in the search [8.0][ADD] web_search_nospace: remove redundant spaces when pasting content into search box Oct 15, 2018
Copy link
Contributor

@simahawk simahawk left a 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

@@ -0,0 +1,40 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
Copy link
Contributor

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

Copy link
Member Author

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)

Copy link
Contributor

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 :)

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
Copy link
Contributor

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"

Copy link
Member

@nikul-serpentcs nikul-serpentcs left a 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)",
Copy link
Member

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

@daramousk daramousk force-pushed the 8.0-web-search-nospace branch from 1f57dc5 to 147b321 Compare October 25, 2018 10:52
@daramousk daramousk force-pushed the 8.0-web-search-nospace branch from f487cda to d19881e Compare January 16, 2019 15:04
Copy link
Contributor

@NL66278 NL66278 left a 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.

@daramousk daramousk force-pushed the 8.0-web-search-nospace branch from d19881e to a6167a4 Compare January 17, 2019 14:00
Copy link
Member

@tarteo tarteo left a 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

@NL66278
Copy link
Contributor

NL66278 commented Jan 17, 2019

@tarteo These lint errors are from a totally different module.

@tarteo
Copy link
Member

tarteo commented Jan 17, 2019

@daramousk
Copy link
Member Author

@simahawk Simone, anything else that needs to be done here?

@daramousk daramousk force-pushed the 8.0-web-search-nospace branch from 88196a0 to bed767a Compare June 11, 2019 09:17
@github-actions
Copy link

github-actions bot commented Apr 3, 2022

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.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 3, 2022
@github-actions github-actions bot closed this May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review stale PR/Issue without recent activity, it'll be soon closed automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants