Skip to content
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

Advanced search bar #21

Open
roaldarbol opened this issue Jan 4, 2024 · 1 comment
Open

Advanced search bar #21

roaldarbol opened this issue Jan 4, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@roaldarbol
Copy link
Collaborator

To accomodate other queries, such as to follow an author by their ORCID ID, the search needs to change. The simplest solution is to have a search bar with a dropdown at the front - see how Amazon implements their search for reference.

I found an example with some code here: https://www.sliderrevolution.com/resources/css-search-box/ - find the Amazon-like Search Box. However, it does rely on JS (jQuery and bootstrap). I assume that it would still be possible to use with htmx?

@roaldarbol roaldarbol added the enhancement New feature or request label Jan 4, 2024
@sneakers-the-rat
Copy link
Owner

I think we can do something like

<form 
  id="search-form" 
  hx-post="/search"
  hx-indicator=".search-indicator"
  hx-target="#search-results"
>
  <select name="search-type">
    <option value="journal">Journal</option>
    <option value="orcid">ORCID</option>
    <option value="keyword">Keyword</option>
  </select>
  <input 
    type="search" 
    name="search" 
    hx-target="#search-form"
    hx-trigger="input changed delay:500ms, search"
  >
</form>

I doubt that's literally it but i guarantee you it's something similar to that where:

  • htmx form with a post command that goes to the search endpoint
  • payload is form-encoded search type and query
  • post is triggered by editing the search bar
  • response to POST replaces #search-results table

see what i am saying about htmx being sick as hell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants