CDRH / orchid

Rails Engine for site integration with CDRH API
MIT License
3 stars 0 forks source link

browse by section feature #88

Closed jduss4 closed 4 years ago

jduss4 commented 6 years ago

Sites like Cody and Neihardt have sections which look very similar to the search results but generally have a custom URL (cody is a bad example for that). We need something in orchid that pulls the pagination / sorting partial, along with the search items results partial and creates a custom view based on a URL.

@lweakly and @karindalziel were okay with the term "section" being used, so what we might do is something like the following pseudocode:

'/section/:section',   'section#items',  as: 'section_path'

The "section" parameter would automatically be sent as a query to the API for f[]=subCategory|section along with the pagination and sorting parameters and then the section.html.erb file would include the necessary partials. This might require a few changes to the search partials in order to make sure that the search results expand to the width of the screen when the facets sidebar is not there.

A few concerns I have: we might have some trouble with urls at the root like /essays and /letters in terms of getting the parameter out of there without screwing up other following URLs at the root of the application, but I think we should cross that bridge later. In order to prepare for it, I think the section action should call a method which does all the same stuff, but that way we could have

def essay
  get_section_result("format|essay")
end

or something similar if we need really unique behavior and we can't pass a parameter through the routing system

jduss4 commented 6 years ago

Examples

Cody:

Neihardt:

Transmississippi:

karindalziel commented 6 years ago

Things to keep in mind:

jduss4 commented 6 years ago

The URL should be customizable to have both category and subcategory if a project needs to override it from /section/[:section], yeah

jduss4 commented 5 years ago

began work on this branch: https://github.com/CDRH/orchid/tree/feature

jduss4 commented 5 years ago

one idea @techgique and I have been brainstorming for a name: "search preset"

techgique commented 5 years ago

I like that name best of what we've discussed so far. It's clear in terms of what we're doing programming-wise in the code. We can label or write the routes however is necessary for each particular website to communicate the purpose there rather than in the name of the functionality we're using in code.

jduss4 commented 4 years ago

I believe that this is essentially done! Might need a little customization later on, but things are pretty much aces as long as we knock out #89 later