projectblacklight / blacklight

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.
http://projectblacklight.org/
Other
760 stars 256 forks source link

Update to 7.0.0 blocked by range limit gem `blacklight_range_limit 6.3.3` #2055

Closed jendiamond closed 4 years ago

jendiamond commented 5 years ago

My Goal:

I am trying to update to 7.0.0 so I can use the new and changeable alt tag.

(I want the alt tag for the thumbnails to be either "thumbnail" or the Title of the image, whichever is best for accessibility. I read that the older versions of Blacklight don't support that but the new ones do.)


So I updated the gem and my app completely broke.

@jcoyne told me that Blacklight::Utils was removed in 7.0. It provided support for Rails 4, which is not supported in Blacklight 7.

Once I commented out the Blacklight::Utils
app/models/user.rb

class User < ApplicationRecord

#  if Blacklight::Utils.needs_attr_accessible?
#    attr_accessible :email, :password, :password_confirmation
#  end

# Connects this user object to Blacklights Bookmarks.
  include Blacklight::User
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :validatable

  # Method added by Blacklight; Blacklight uses #to_s on your
  # user class to get a user-displayable login/identifier for
  # the account.
  def to_s
    email
  end
end

My app runs again but I still have an error which looks like it doesn't like the new include tag, include Blacklight::DefaultComponentConfiguration.

I now get this error:

undefined local variable or method `blacklight_config' for CatalogController:Class
Rails.root: /ursus

Application Trace | Framework Trace | Full Trace
app/controllers/catalog_controller.rb:7:in `include'
app/controllers/catalog_controller.rb:7:in `<class:CatalogController>'
app/controllers/catalog_controller.rb:5:in `<top (required)>'

Then, I commented out the include Blacklight::DefaultComponentConfiguration in the app/controller/catalog/controller and I added these configs at the bottom of the app/controller/catalog/controller page as per the release instructions.

    config.add_results_document_tool(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)

    config.add_results_collection_tool(:sort_widget)
    config.add_results_collection_tool(:per_page_widget)
    config.add_results_collection_tool(:view_type_group)

    config.add_show_tools_partial(:bookmark, partial: 'bookmark_control', if: :render_bookmarks_control?)
    config.add_show_tools_partial(:email, callback: :email_action, validator: :validate_email_params)
    config.add_show_tools_partial(:sms, if: :render_sms_action?, callback: :sms_action, validator: :validate_sms_params)
    config.add_show_tools_partial(:citation)

    config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?)
    config.add_nav_action(:search_history, partial: 'blacklight/nav/search_history')

New Error

I believe this has to do with using the range gem blacklight_range_limit 6.3.3
Is that gem now included in blacklight and therefore the app breaks because of it?

NameError in Catalog#index

Showing /usr/local/bundle/gems/blacklight_range_limit-6.3.3/app/views/blacklight_range_limit/_range_limit_panel.html.erb where line #2 raised:

undefined local variable or method `solr_field' for #<#<Class:0x0000555b8bd35bf8>:0x0000555b8bd1a150>

1 <%- # requires solr_config local passed in
2  field_config = range_config(solr_field)  
3  label = facet_field_label(solr_field)
4
5   input_label_range_begin = field_config[:input_label_range_begin] || t("blacklight.range_limit.range_begin", field_label: label)
6  input_label_range_end   = field_config[:input_label_range_end] || t("blacklight.range_limit.range_end", field_label: label)

Is it too soon to upgrade?

I was wondering if I should try your newest release which is v6.19.2 ?

If anyone has the time to walk through an upgrade with me I can contribute to the documentation with the issues that arise.

barmintor commented 5 years ago

Hi @jendiamond, thanks for opening the issue. There's been some conversation about getting a new release of the range_limit plugin out in the slack at code4lib: There's been a release candidate since July, but no one has been able to push 7.0.0 plugin release since the Blacklight release.

barmintor commented 5 years ago

You might try to use the RC: https://rubygems.org/gems/blacklight_range_limit/versions/7.0.0.rc2

Your feedback might help push the release out the door!

jendiamond commented 5 years ago

Hi @barmintor,

Doesn't this error seem as though the thing blocking my app from loading is in the blacklight code and not ours.

I'd really love to get this update working for our team so we can handle some of our accessibility issues.

barmintor commented 5 years ago

To me your error message seems like it's coming from the blacklight_range_limit code, which is trying to use BL6 APIs. But you have to change your dependencies to use a newer version of the range limit plugin.

jendiamond commented 5 years ago

Cool, thanks @barmintor. I will try that.

I checked and it seems like blacklight_range_limit 6.3.3 is the most current release. https://github.com/projectblacklight/blacklight_range_limit/releases

Am I missing something else?

I just realized that you said blacklight_range_limit/versions/7.0.0.rc2. I thought you were saying update to the RC of Blacklight which didn't make any sense.

I updated the range_limit gem and now I have bootstrap errors. Which seems like a step in the right direction!

Any advice about updating the Bootstrap?

barmintor commented 5 years ago

Not off the top of my head - what are the errors you're seeing?

jcoyne commented 5 years ago

There's a very helpful upgrade guide here: https://getbootstrap.com/docs/4.0/migration/

mejackreed commented 5 years ago

Also please checkout and contribute to: https://github.com/projectblacklight/blacklight/wiki/Bootstrap-3-to-4-Migration-Guide

jrochkind commented 5 years ago

A blacklight_range_limit 7.0.0 has been released. I have not tried it and don't know anything about it myself.

Is this ticket still relevant, or is it taken care of?