Open actlikewill opened 3 weeks ago
When a search is run, the Vue search app puts the search alert box into the page and uses HTMX (ajax?) to load the content of the box. This allows the server to check if a search alert for this search already exists.
GET /search/saved-searches/check?q=...
renders the search alert box, customised if the user is logged in and if they have already saved this searchIf the user is not logged in, that html has a normal bootstrap modal with the login prompt, no special HTMX or JS needed.
If the user is logged in, and they have not saved this search, the button is part of a form which POSTs to a new endpoint that is submitted with HTMX and the box is updated with the text for a newly created saved search alert.
POST /search/saved-searches
If the user is logged in and they have saved this search before, the box has an Unsubscribe experience that deletes the saved search.
POST /search/saved-searches/<pk>/delete
The search alert listing page also doubles as a detail page. It is part of the user profile page.
A search alert can be deleted by posting to the same deletion endpoint as above.
Clicking on a search alert opens the search page with all the details filled in.
Users should be able to save some of their commonly repeated searches and be able to perform the same search with a single click. This feature will be most useful if it is quick and easliy accessible. While searching, users can be prompted to save a search in a non-intrusive manner, and still while searching, users can be prompted to bring up a saved search. Users should be able to view and remove previously saved searches.
Proposal
UX
Search page
When a user performs a search we show a "Subscribe" button in a box above the search results prompting them to subscribe to alerts for this search when new content is added.
If the user clicks on the button:
Search alerts page Users should be able to access their search alerts through a "Search Alerts" listing page. The page will display saved searches in a list view, sorted by date, showing:
Implementation
Add a new
SavedSearch
model with the following fields:Search results page
Saved searches page
Create a dedicated page with a simple list view for saved searches, displaying:
Save Search API Endpoint
Add a drf API endpoint to handle saving searches with relevant data (POST request): It should accept the search term, filter_parameters, note, user, and number of results.