CDRH / orchid

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

Overwriting default sort disables ability to change sort #226

Closed karindalziel closed 2 years ago

karindalziel commented 2 years ago

When I use the controller to change a default sort

def reception_reviews
    options = params.permit!.deep_dup
    options["f"] = ["subcategory|Reception/Reviews"]
    options["sort"] = ["date|asc"]
    @res = $api.query(options)

    # render search preset with route information
    @route_path = "reception_reviews_path"
    render_overridable "items", "reception_reviews"
  end

https://github.com/CDRH/chesnutt/blob/main/app/controllers/items_override.rb#L107

The sort breaks - changing it does not change the sort. For now, in chesnutt, I am going to remove the ability to sort the items, but this isn't a great long term solution. https://cdrhdev1.unl.edu/chesnutt/reception/reviews

techgique commented 2 years ago

Not a bug with Orchid etc. Just a derp with the override: https://github.com/CDRH/chesnutt/commit/f00eabe8ccf93daa38cbeea1a013a860d2b4c307

techgique commented 2 years ago

And this tweak fixes the default sort display: https://github.com/CDRH/chesnutt/commit/5554ae51b399f58df627edffd1c5c18235b30465