hathitrust / firebird-common

Other
0 stars 0 forks source link

DEV-918: fix catalog advanced search full-view checkbox #46

Closed carylwyatt closed 1 year ago

carylwyatt commented 1 year ago

As I understand it, the problem is that regardless of search history or how a user arrives on (catalog?) advanced search, the full-view only checkbox is always toggled to checked/true (via isFullView variable).

The solution @moseshll requested (and I think is probably the easiest solution) is to check the URL parameters for ft=ft and set isFullView from that.

I think I did that! Thanks to my linter hating Roger's linter, it looks like I changed a bunch of stuff, but it's really just lines 298-300:

 if (!params.get('ft')) {
    isFullView = false;
}

Next steps?

netlify[bot] commented 1 year ago

Deploy Preview for hathitrust-firebird-common ready!

Name Link
Latest commit dc080e9f659e3df005c467cfc33e70c6194a5e35
Latest deploy log https://app.netlify.com/sites/hathitrust-firebird-common/deploys/6508595e3c125f00090a5c3e
Deploy Preview https://deploy-preview-46--hathitrust-firebird-common.netlify.app/
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

carylwyatt commented 1 year ago

Updated the conditional to make sure the checkbox defaults to Full-View if somehow the user ends up at /Search/Advanced without any params:

let theUrl = window.location.href;

if (!params.get('ft') && theUrl.includes('?')) {
    isFullView = false;
}

staged on https://beta-1.catalog.hathitrust.org/Search/Advanced

carylwyatt commented 1 year ago

Seemed like this could be simplified:

~let theUrl = window.location.href;~

if (!params.get('ft') && window.location.href.includes('?')) {
    isFullView = false;
}