Skip to content

Update to Blacklight 7.0.1

Eric Larson edited this page Mar 27, 2019 · 2 revisions

File to be changed

  • Gemfile
  • app/views/layouts/application.html.erb
  • app/controllers/catalog_controller.rb
  • app/assets/stylesheets/blacklight.scss
  • app/models/user.rb

  1. Update Blacklight gem to 7.0.1

Gemfile

gem 'blacklight', '~> 7.0.1'

$ bundle update blacklight


  1. Remove Blacklight::Utils
    Blacklight::Utils was removed in blacklight 7.0. It provided support for Rails 4, which is not supported in Blacklight 7.

Delete the following block from app/models/user.rb

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

  1. Add some configuration to the catalog_controller

app/controllers/catalog_controller.rb
Add all of this within the block configure_blacklight do |config|

# Blacklight update to 7.0.0
    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')

  1. Update blacklight_range_limit gem

Gemfile

gem 'blacklight_range_limit', '~> 7.0.0'

$ bundle


  1. Delete bootstrap-sprockets && blacklight/blacklight

app/assets/stylesheets/blacklight.scss

@import 'bootstrap-sprockets';
@import 'blacklight/blacklight';

  1. Add Bootstrap 4

Gemfile

gem 'bootstrap', '~> 4.0'

$ bundle


  1. Change the main layout page

app/views/layout/blacklight.html.erb
From: <%= render partial: 'shared/ajax_modal' %>
To: <%= render partial: 'shared/modal' %>

and

From: <%= render :partial=>'/flash_msg', layout: 'shared/flash_messages' %>
To: <%= render :partial=>'shared/flash_msg', layout: 'shared/flash_messages' %>


  1. Update application_controller.rb

Add the following layout function, so the proper layout is determined for index versus show pages. From: https://github.com/projectblacklight/blacklight/blob/v7.0.1/lib/generators/blacklight/controller_generator.rb#L20

  layout :determine_layout if respond_to? :layout
  1. Update Node
    If you are using Docker this might help https://hub.docker.com/r/starefossen/ruby-node/ Dockerfile
FROM starefossen/ruby-node

Don't forget to re-start your server.

Clone this wiki locally