Skip to content

Commit

Permalink
Merge pull request #5730 from samvera/bl7boot4rails6
Browse files Browse the repository at this point in the history
Upgrade to Blacklight 7, Bootstrap 4 and Rails 6.0
  • Loading branch information
dlpierce authored Jun 28, 2022
2 parents e3c0e52 + 9ce6e09 commit 94cd8e0
Show file tree
Hide file tree
Showing 431 changed files with 44,527 additions and 7,223 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
default: 2.3.13
rails_version:
type: string
default: '5.2.8'
default: 6.0.5
executor:
name: 'samvera/ruby'
ruby_version: << parameters.ruby_version >>
Expand Down Expand Up @@ -74,15 +74,15 @@ jobs:
default: 2.3.13
rails_version:
type: string
default: '5.2.8'
default: 6.0.5
executor:
name: 'samvera/ruby_fcrepo_solr_redis_postgres'
ruby_version: << parameters.ruby_version >>
resource_class: medium+
environment:
RAILS_VERSION: << parameters.rails_version >>
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
ENGINE_CART_RAILS_OPTIONS: --database=postgresql --skip-git --skip-bundle --skip-listen --skip-spring --skip-keeps --skip-test --skip-bootsnap
ENGINE_CART_RAILS_OPTIONS: --database=postgresql --skip-git --skip-bundle --skip-listen --skip-spring --skip-keeps --skip-test --skip-bootsnap --skip-javascript
DATABASE_URL: postgresql://[email protected]/circle_test # Hard-coded with data from CircleCI orb, related to https://github.com/samvera-labs/samvera-circleci-orb/issues/42
steps:
- attach_workspace:
Expand Down Expand Up @@ -172,11 +172,11 @@ workflows:
jobs:
- bundle:
ruby_version: "2.7.6"
rails_version: "5.2.8"
rails_version: "6.0.5"
bundler_version: "2.3.13"
- build:
ruby_version: "2.7.6"
rails_version: "5.2.8"
rails_version: "6.0.5"
bundler_version: "2.3.13"
requires:
- bundle
Expand Down
6 changes: 3 additions & 3 deletions .dassie/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.6'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.4', '>= 5.2.4.4'
gem 'rails', '~> 6.0'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 4.3.8'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'sass-rails', '~> 6.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

Expand Down Expand Up @@ -52,7 +52,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gemspec name: 'hyrax', path: ENV.fetch('HYRAX_ENGINE_PATH', '..')

gem 'bootstrap-sass', '~> 3.0'
gem 'bootstrap', '~> 4.0'
gem 'devise'
gem 'devise-guests', '~> 0.6'
gem 'jquery-rails'
Expand Down
12 changes: 8 additions & 4 deletions .dassie/app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@
//= require turbolinks
//
// Required by Blacklight
//= require jquery
//= require jquery_ujs
//= require dataTables/jquery.dataTables
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
//= require jquery3
//= require rails-ujs
//= require popper
//= require twitter/typeahead
//= require bootstrap
//= require jquery.dataTables
//= require dataTables.bootstrap4
//= require blacklight/blacklight
//= require blacklight_gallery

//= require_tree .
//= require hyrax
Expand Down
2 changes: 1 addition & 1 deletion .dassie/app/assets/stylesheets/application.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
* It is generally better to create a new file per style scope.
*
*= require_tree .
*= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
*= require dataTables.bootstrap4
*= require_self
*/
3 changes: 1 addition & 2 deletions .dassie/app/assets/stylesheets/hyrax.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
*= require_self
*/

@import "bootstrap-sprockets";
@import "bootstrap-default-overrides";
@import 'bootstrap';
@import 'blacklight/blacklight';
@import "font-awesome";
@import "blacklight_gallery/gallery";
@import "blacklight_gallery/masonry";
@import "blacklight_gallery/slideshow";
@import "blacklight_gallery/osd_viewer";
@import "hyrax/blacklight_gallery";
@import 'hyrax/hyrax';
@import 'hyrax/login_signup';
4 changes: 1 addition & 3 deletions .dassie/app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ class ApplicationController < ActionController::Base
helper Openseadragon::OpenseadragonHelper
# Adds a few additional behaviors into the application controller
include Blacklight::Controller
skip_after_action :discard_flash_if_xhr
include Hydra::Controller::ControllerBehavior

# Adds Hyrax behaviors into the application controller
include Hyrax::Controller
include Hyrax::ThemedLayoutController
with_themed_layout '1_column'


with_themed_layout '1_column'
end
42 changes: 23 additions & 19 deletions .dassie/app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ class CatalogController < ApplicationController

# This filter applies the hydra access controls
before_action :enforce_show_permissions, only: :show
# Allow all search options when in read-only mode
skip_before_action :check_read_only

def self.uploaded_field
"system_create_dtsi"
Expand All @@ -17,19 +15,14 @@ def self.modified_field
end

configure_blacklight do |config|
config.view.gallery.partials = [:index_header, :index]
config.view.masonry.partials = [:index]
config.view.slideshow.partials = [:index]

config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)
config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent)
config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent)

config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
config.show.partials.insert(1, :openseadragon)
config.search_builder_class = Hyrax::CatalogSearchBuilder

# Show gallery view
config.view.gallery.partials = [:index_header, :index]
config.view.slideshow.partials = [:index]

# Because too many times on Samvera tech people raise a problem regarding a failed query to SOLR.
# Often, it's because they inadvertently exceeded the character limit of a GET request.
config.http_method = :post
Expand All @@ -46,6 +39,17 @@ def self.modified_field
config.index.display_type_field = "has_model_ssim"
config.index.thumbnail_field = 'thumbnail_path_ss'

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')

# solr fields that will be treated as facets by the blacklight application
# The ordering of the field names is the order of the display
config.add_facet_field "human_readable_type_sim", label: "Type", limit: 5
Expand Down Expand Up @@ -74,22 +78,22 @@ def self.modified_field
# The ordering of the field names is the order of the display
config.add_index_field "title_tesim", label: "Title", itemprop: 'name', if: false
config.add_index_field "description_tesim", itemprop: 'description', helper_method: :iconify_auto_link
config.add_index_field "keyword_tesim", itemprop: 'keywords', link_to_search: "keyword_sim"
config.add_index_field "subject_tesim", itemprop: 'about', link_to_search: "subject_sim"
config.add_index_field "creator_tesim", itemprop: 'creator', link_to_search: "creator_sim"
config.add_index_field "contributor_tesim", itemprop: 'contributor', link_to_search: "contributor_sim"
config.add_index_field "keyword_tesim", itemprop: 'keywords', link_to_facet: "keyword_sim"
config.add_index_field "subject_tesim", itemprop: 'about', link_to_facet: "subject_sim"
config.add_index_field "creator_tesim", itemprop: 'creator', link_to_facet: "creator_sim"
config.add_index_field "contributor_tesim", itemprop: 'contributor', link_to_facet: "contributor_sim"
config.add_index_field "proxy_depositor_ssim", label: "Depositor", helper_method: :link_to_profile
config.add_index_field "depositor_tesim", label: "Owner", helper_method: :link_to_profile
config.add_index_field "publisher_tesim", itemprop: 'publisher', link_to_search: "publisher_sim"
config.add_index_field "based_near_label_tesim", itemprop: 'contentLocation', link_to_search: "based_near_label_sim"
config.add_index_field "language_tesim", itemprop: 'inLanguage', link_to_search: "language_sim"
config.add_index_field "publisher_tesim", itemprop: 'publisher', link_to_facet: "publisher_sim"
config.add_index_field "based_near_label_tesim", itemprop: 'contentLocation', link_to_facet: "based_near_label_sim"
config.add_index_field "language_tesim", itemprop: 'inLanguage', link_to_facet: "language_sim"
config.add_index_field "date_uploaded_dtsi", itemprop: 'datePublished', helper_method: :human_readable_date
config.add_index_field "date_modified_dtsi", itemprop: 'dateModified', helper_method: :human_readable_date
config.add_index_field "date_created_tesim", itemprop: 'dateCreated'
config.add_index_field "rights_statement_tesim", helper_method: :rights_statement_links
config.add_index_field "license_tesim", helper_method: :license_links
config.add_index_field "resource_type_tesim", label: "Resource Type", link_to_search: "resource_type_sim"
config.add_index_field "file_format_tesim", link_to_search: "file_format_sim"
config.add_index_field "resource_type_tesim", label: "Resource Type", link_to_facet: "resource_type_sim"
config.add_index_field "file_format_tesim", link_to_facet: "file_format_sim"
config.add_index_field "identifier_tesim", helper_method: :index_field_link, field_name: 'identifier'
config.add_index_field Hydra.config.permissions.embargo.release_date, label: "Embargo release date", helper_method: :human_readable_date
config.add_index_field Hydra.config.permissions.lease.expiration_date, label: "Lease expiration date", helper_method: :human_readable_date
Expand Down
3 changes: 0 additions & 3 deletions .dassie/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ class User < ApplicationRecord
include Hyrax::User
include Hyrax::UserUsageStats

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:
Expand Down
2 changes: 1 addition & 1 deletion .dassie/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
module Dassie
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2
config.load_defaults 6.0

# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
Expand Down
2 changes: 1 addition & 1 deletion .dassie/config/initializers/riiif.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end
end

Riiif::Image.authorization_service = Hyrax::IIIFAuthorizationService
Riiif::Image.authorization_service = Hyrax::IiifAuthorizationService

Riiif.not_found_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
Riiif.unauthorized_image = Rails.root.join('app', 'assets', 'images', 'us_404.svg')
Expand Down
10 changes: 5 additions & 5 deletions .dassie/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.

Expand Down
14 changes: 7 additions & 7 deletions .dassie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"private": true,
"repository": "[email protected]:samvera/hyrax.git",
"dependencies": {
"universalviewer": "^3.0.16"
},
"scripts": {
"preinstall": "rm -rf ./public/uv",
"postinstall": "yarn run uv-install && yarn run uv-config",
"uv-install": "cp -r ./node_modules/universalviewer/dist ./public/uv",
"uv-config": "cp ./config/uv/uv.html ./public/uv/uv.html & cp ./config/uv/uv-config.json ./public/uv/"
"universalviewer": "^3.1.4"
},
"scripts": {
"preinstall": "rm -rf ./public/uv",
"postinstall": "yarn run uv-install && yarn run uv-config",
"uv-install": "cp -r ./node_modules/universalviewer/dist ./public/uv",
"uv-config": "cp ./config/uv/uv.html ./public/uv/uv.html & cp ./config/uv/uv-config.json ./public/uv/"
},
"devDependencies": {}
}
40 changes: 0 additions & 40 deletions .engine_cart.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .regen
Original file line number Diff line number Diff line change
@@ -1 +1 @@
44
500bl7boot4rails6
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inherit_gem:
bixby: bixby_default.yml

AllCops:
TargetRubyVersion: 2.5
TargetRubyVersion: 2.6
DisplayCopNames: true
Exclude:
- 'db/**/*'
Expand Down
Loading

0 comments on commit 94cd8e0

Please sign in to comment.