elasticsearch - How to clear the search results in a Rails app? -
i'm rails noob, , looking assistance in clearing results of search.
i've built sample application lists cafes, , have implemented searching using elasticsearch , searchkick. search function appends parameters url in http://localhost:3000/cafes?search=sydney&commit=search , working correctly.
now i'd add button clear search results:
the clear button's link cafes_path
(http://localhost:3000/cafes), reloads page without search parameters:
= form_tag cafes_path, :method => :get = text_field_tag :search = submit_tag value = "search" = link_to cafes_path
- is acceptable way clear search?
- is acceptable rails approach use javascript logic enable/disable clear button, based on what's in search box?
please let me know if need see more of model or controller code make sense of question.
- this way pretty standard
- sure, use javascript - or can google other ways it's been done , see did.
Comments
Post a Comment