Plots2: Insert hyphens into tag search input query

Created on 15 Feb 2018  ·  9Comments  ·  Source: publiclab/plots2

(via @ebarry) On this page: https://publiclab.org/questions/ in the sidebar, we let people filter by tag, but when you type water quality, it doesn't offer the tag name water-quality (because all tagnames are hyphenated).

The logic for the query is here:

https://github.com/publiclab/plots2/blob/d078466a6dc1c1c4ae3b39e45a8ccb861b7d5860/app/views/tag/_sorting.html.erb#L15

Let's insert a filter to replace spaces with hyphens as people type. So we should be able to replace query with:

query.replace(' ', '-')

This'll improve matching overall and make it default that it selects a good related tag for many more possible inputs.

Any help appreciated on this!!! 👍

JavaScript enhancement fto-candidate help wanted

Most helpful comment

Hi everybody! I am a beginner in this open source world and I would like to contribute for the project. I was working on this issue just to get familiar with the code and @stefannibrasil's solution is correct. I know @utsha1510 is working on the issue, but if the problem remains open after all I would like to open the PR. ;)

All 9 comments

working on this

That's great @utsha1510 .If you have any query please feel free to ask.Thanks.

@utsha1510 how are you doing? Can we help out at all?

I'm a beginner to open source so I'm working on it and will let you know if
help needed.

On Feb 21, 2018 9:27 PM, "Jeffrey Warren" notifications@github.com wrote:

@utsha1510 https://github.com/utsha1510 how are you doing? Can we help
out at all?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/2335#issuecomment-367373159,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AVD2lmD77kSOgfW5TtjSz657utlkCMHRks5tXDyzgaJpZM4SHMZS
.

Hey, everyone! It looks like only changing query on line 15 does not work. Check here: https://stackoverflow.com/questions/14262770/javascript-replace-dash-hyphen-with-a-space

So maybe assign the replace method to a new variable like:

var replaced_query = query.replace(' ', '-');

and replacing query on line 15 with the one above should work. Let me know if I can help more :)

Thanks @stefannibrasil -- awesome suggestion!

Hi everybody! I am a beginner in this open source world and I would like to contribute for the project. I was working on this issue just to get familiar with the code and @stefannibrasil's solution is correct. I know @utsha1510 is working on the issue, but if the problem remains open after all I would like to open the PR. ;)

Hi, @utsha1510 -- we'd love to find you another issue to work on if you're interested and this one ends up being taken.

Here, I just made this one: https://github.com/publiclab/plots2/issues/2379

Feel free to claim it! And welcome!!!

Hi @jywarren! I created the PR, can you check if I did everything right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

grvsachdeva picture grvsachdeva  ·  3Comments

first-timers[bot] picture first-timers[bot]  ·  3Comments

divyabaid16 picture divyabaid16  ·  3Comments

first-timers[bot] picture first-timers[bot]  ·  3Comments

RuthNjeri picture RuthNjeri  ·  3Comments