Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install on Rails 7/Blacklight 8 #236

Open
jrochkind opened this issue Jul 5, 2023 · 5 comments
Open

Install on Rails 7/Blacklight 8 #236

jrochkind opened this issue Jul 5, 2023 · 5 comments

Comments

@jrochkind
Copy link
Member

jrochkind commented Jul 5, 2023

I am having trouble figuring out how to install this on Rails 7/Blacklight 8.

Starting with an empty Blacklight app (created via Blacklight install instructions), with Rails 7.0.6 and Blacklight 8.0.1, if we try to run the blacklight_range_limit (8.3.0) installer , we get an error:

The file /Users/jrochkind/code/blacklight_8_demo/app/assets/javascripts/application.js does not appear to exist

So it can't install the blacklight_range_limit JS, and does not work.

I am experimenting with various hacky ways to try to get it to work. I am wondering if anyone has gotten it to work with a pre-existing app they upgraded to Rails 7/BL8?

But it would be good to have a documented way for newcomers with new apps. Additionally, I'm running into headaches trying to hack it out, and would love to be able to start with a "known working good" pattern for installing blacklight_range_limit with BL8 and Rails 7.

One hacky way involving sprockets

This is so not a recommended/ready for generator way, this is a super hacky thing I've figured out just so I can actually testing Rails 7/BL8/blacklight_range_limit locally in an otherwise stock BL app. Also I haven't actually gotten it to a working demo yet!

Starting with default out of the box app created with BL install instrutions, BL 8.0.1 and Rails 7.0.6. We're going to add blacklight_range_limit via sprockets, but make sure it has runtime access to dependencies it needs that were loaded via other means.

  1. We need JQuery available, range limit depends on that. One way to do that is:

    • Edit your ./config/importmap.rb to add something like pin "jquery", to: "https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.js"
    • Over in your existing ./app/javascript/application.js, add import "jquery";
  2. The sprockets-included blacklight_range_limit.js will need access to window.Blacklight.

    • Over in the existing ./app/javascript/application.js (note different path than above), at the end of file add: window.Blacklight = Blacklight;
  3. We are going to include blacklight_range_limit.js with sprockets. This is the hackiest part. In order to get a sprockets pipeline ALSO into blank blacklight demo app.

    • Create an ./app/assets/javascripts/sprockets_application.js.
      • Note different path and name, I think we can't call it application.js to avoid conflict, but not sure.
      • Add //= require 'blacklight_range_limit' to this file
    • add //= link sprockets_application.js to your local ./app/assets/config/maninfest.js
    • Copy from blacklight gem ./app/views/blacklight/base.html.erb to local app same location. (*This is the main thing that is not feasible for general instructions!)
    • Edit that file to add <%= javascript_include_tag "sprockets_application" %> to bottom of <head> section.

This APPEARS to get the blacklight_range_limit JS loading... but I still can't get things to actually work, my configuration in catalog controller per README is not working, it's giving me a weird blank facet in sidebar with no title or content.

So even with this hacky setup, I still don't actually have a working demo app. it's possible blacklight_range_limit JS doesn't work with BL 8.... but I actually do it have it sort of working -- further than this -- in my main app, I just have no idea how I got there and can't reproduce it!

I could really use a known working out of the box setup to start from, so I can troubleshoot my own app at least.

(I have not personally managed to get CI to run locally either, that's a different story maybe, it's failing for other reasons I think. But not sure if CI would run with BL 8 or not -- it's possible it hasn't been run on this repo since BL8 was released?)

@jcoyne
Copy link
Member

jcoyne commented Jul 5, 2023

@jrochkind
Copy link
Member Author

Thanks @jcoyne

Yeah, I didn't realize that this was very not supported on Blacklight 8 at present.

I think there is yet more undiscovered stuff -- when I just try running range_facet_component_spec.rb, on it's own, I think I get a bunch of different failures, layers on top of layers -- like when I fix one, I get others.

I think it's got quite a bit of work to actually be passing tests on BL8. I don't know how many of the problems are just test infrastructure problems vs actual runtime code problems -- I think I have the thing actually working -- for the features I use -- in my own app, although I'm not totally sure how I managed to get it set up, and haven't managed to get it set up in a from-scratch app!

I think maybe this is going to take quite a bit of work, on several different things, some probably not yet discovered, to actually pass tests and work on BL8. OK, I hadn't realized it wasn't passing tests or working on BL8 yet.

@jrochkind
Copy link
Member Author

but wait, maybe that's not right either... Blacklight 8 was specifically allowed in gemspec at:

62874b4

By @cbeer and/or @barmintor.

So maybe at one point it was passing tests, as well as working, on BL 8? @barmintor or @cbeer , do you remember any context as to when you allowed that in the gemspec?

I don't think it is currenty passing tests on BL8. (It's not for me locally, but that could be just me?)

It looks like the last time tests CI ran was "4 months ago"; the output of that CI run is no longer available. I am not sure the exact date it ran. I don't think we have access to knowing what version of BL it ran with, whether 8.0.0 or a beta or otherwise.

@barmintor
Copy link
Contributor

There are several draft PRs of Blacklight committers trying to get different aspects of this to work on modern Rails/Blacklight/Bootstrap. The last successful run was almost certainly against Blacklight 7.33.1

@Slange-Mhath
Copy link

We are currently facing the same issue, is there any update on this yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants