Skip to content

Commit

Permalink
Merge branch 'main' into clover-iiif
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkkwang committed Jul 18, 2023
2 parents 410b3cf + a35ee09 commit 58ef40e
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 35 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ group :development do
# gem 'xray-rails' # when using this gem, know that sidekiq will not work
end

gem 'bulkrax', git: 'https://github.com/samvera-labs/bulkrax.git', branch: 'main'
gem 'bulkrax', git: 'https://github.com/samvera-labs/bulkrax.git', ref: 'e6f2cf9'

gem 'allinson_flex', git: 'https://github.com/samvera-labs/allinson_flex.git'
gem 'blacklight', '~> 6.7'
Expand All @@ -99,7 +99,7 @@ gem 'redlock', '~>1.2.2'

gem 'hyrax-iiif_av', git: 'https://github.com/samvera-labs/hyrax-iiif_av.git', branch: 'utk-hyku-with-hyrax-3'
gem 'iiif_manifest', git: 'https://github.com/samvera/iiif_manifest.git', ref: 'e5d8a2d'
gem 'iiif_print', git: 'https://github.com/scientist-softserv/iiif_print.git', branch: 'no-rodeo'
gem 'iiif_print', git: 'https://github.com/scientist-softserv/iiif_print.git', branch: 'main'

gem 'bolognese', '>= 1.9.10'
gem 'hyrax-doi', git: 'https://github.com/samvera-labs/hyrax-doi.git'
Expand Down
23 changes: 16 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/samvera-labs/allinson_flex.git
revision: c1dfe12e5386f8f4325b3a19dde949ecef1fede3
revision: e98815f6178cc17fab70c189d0fe96a618384a7a
specs:
allinson_flex (0.1.0)
json_schemer
Expand All @@ -10,8 +10,8 @@ GIT

GIT
remote: https://github.com/samvera-labs/bulkrax.git
revision: ae05be9a0dd7fa95d260069c5274c816e24293bd
branch: main
revision: e6f2cf94730ea7db236a6f3280d3dc3967f5495e
ref: e6f2cf9
specs:
bulkrax (5.2.1)
bagit (~> 0.4)
Expand Down Expand Up @@ -124,17 +124,17 @@ GIT

GIT
remote: https://github.com/scientist-softserv/iiif_print.git
revision: 9f20467a6ff1f14872087f1e1dddda0f9fea91fd
branch: no-rodeo
revision: 7b82aa323db891f5f8e362e13bf3f14b4fe9e0dc
branch: main
specs:
iiif_print (1.0.0)
blacklight_iiif_search (~> 1.0)
derivative-rodeo (~> 0.4)
dry-monads (~> 1.4.0)
hyrax (>= 2.5, < 4.0)
hyrax (>= 2.5, < 4)
nokogiri (>= 1.13.2)
rails (~> 5.0)
rdf-vocab (~> 3.0)
reform-rails (= 0.2.3)

GIT
remote: https://github.com/tawan/active-elastic-job.git
Expand Down Expand Up @@ -405,6 +405,15 @@ GEM
declarative-option (0.1.0)
deprecation (1.1.0)
activesupport
derivative-rodeo (0.4.2)
activesupport (>= 5)
aws-sdk-s3
aws-sdk-sqs
httparty
marcel
mime-types
mini_magick
nokogiri
devise (4.8.1)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down
7 changes: 7 additions & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class CatalogController < ApplicationController
include Hydra::Catalog
include Hydra::Controller::ControllerBehavior
include BlacklightOaiProvider::Controller
include AllinsonFlex::DynamicCatalogBehavior

# These before_action filters apply the hydra access controls
before_action :enforce_show_permissions, only: :show
Expand All @@ -16,6 +17,10 @@ def self.modified_field
'system_modified_dtsi'
end

def self.title_field
'title_ssi'
end

# CatalogController-scope behavior and configuration for BlacklightIiifSearch
include BlacklightIiifSearch::Controller

Expand Down Expand Up @@ -378,6 +383,8 @@ def self.modified_field
# except in the relevancy case).
# label is key, solr field is value
config.add_sort_field "score desc, #{uploaded_field} desc", label: "relevance"
config.add_sort_field "#{title_field} desc", label: "title \u25BC"
config.add_sort_field "#{title_field} asc", label: "title \u25B2"
config.add_sort_field "#{uploaded_field} desc", label: "date uploaded \u25BC"
config.add_sort_field "#{uploaded_field} asc", label: "date uploaded \u25B2"
config.add_sort_field "#{modified_field} desc", label: "date modified \u25BC"
Expand Down
1 change: 1 addition & 0 deletions app/indexers/app_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class AppIndexer < Hyrax::WorkIndexer
def generate_solr_document
super.tap do |solr_doc|
solr_doc["account_cname_tesim"] = Site.instance&.account&.cname
solr_doc[CatalogController.title_field] = object.title.first
end
end
end
1 change: 1 addition & 0 deletions app/indexers/collection_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def generate_solr_document
super.tap do |solr_doc|
solr_doc["bulkrax_identifier_sim"] = object.bulkrax_identifier
solr_doc["account_cname_tesim"] = Site.instance&.account&.cname
solr_doc[CatalogController.title_field] = object.title.first
end
end
end
3 changes: 2 additions & 1 deletion app/models/iiif_search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# SearchBuilder for full-text searches with highlighting and snippets
class IiifSearchBuilder < Blacklight::SearchBuilder
include Blacklight::Solr::SearchBuilderBehavior
include IiifPrint::AllinsonFlexFields

self.default_processor_chain += [:ocr_search_params]
self.default_processor_chain += %i[ocr_search_params include_allinson_flex_fields]

# set params for ocr field searching
def ocr_search_params(solr_parameters = {})
Expand Down
9 changes: 9 additions & 0 deletions app/presenters/hyrax/collection_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ def [](key)
end
end

# override to hide empty fields
def terms_with_values
self.class.terms.select do |t|
value = send(t).try(:first)
# total_items is always displayed
t == :total_items || value.present?
end
end

# override banner_file in hyrax to include all banner information rather than just relative_path
def banner_file
@banner_file ||= begin
Expand Down
21 changes: 15 additions & 6 deletions app/views/catalog/_index_header_list_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<%# OVERRIDE Hyrax 3.4.0 to support shared search %>
<%# OVERRIDE Hyrax 3.4.2 add classes for custom styling %>
<%# OVERRIDE Hyrax 3.5.0 to bring in parent_query for UV auto searching %>
<% model = document.hydra_model %>
<div class="search-results-title-row">
<% if model == Hyrax::PcdmCollection || model < Hyrax::PcdmCollection %>
<h4 class="search-result-title collection"><%= link_to document.title_or_label, generate_work_url(document, request) %></h4>
<%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %>
<% else %>
<h4 class="search-result-title work"><%= link_to document.title_or_label, generate_work_url(document, request) %></h4>
<% end %>
<% if model == Hyrax::PcdmCollection || model < Hyrax::PcdmCollection %>
<h4 class="search-result-title collection"><%= link_to document.title_or_label, generate_work_url(document, request) %></h4>
<%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %>
<% else %>
<h3 class="search-result-title work">
<% if params['q'].present? && document.any_highlighting? %>
<%= link_to document.title_or_label, [document, { parent_query: params['q'] }] %>
<% elsif params['q'].present? %>
<%= link_to document.title_or_label, [document, { query: params['q'] }] %>
<% else %>
<%= link_to document.title_or_label, document %>
<% end %>
</h3>
<% end %>
</div>
4 changes: 1 addition & 3 deletions app/views/themes/dc_show/hyrax/base/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<div class="col-sm-12">
<%= render 'work_type', presenter: @presenter %>
</div>
<%# OVERRIDE: Hyrax v3.4.2 - show_actions being commented out in case they are needed in the future. %>
<%#= render 'show_actions', presenter: @presenter %>
<%# OVERRIDE: Hyrax v3.4.2 - add classes %>
<%= render 'show_actions', presenter: @presenter %>
<div class="works-panel uv-panel">
<div class="panel-body">
<div class="row">
Expand Down
27 changes: 14 additions & 13 deletions config/uv/uv.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@
}
</style>
<script type="text/javascript">
window.addEventListener('uvLoaded', function(e) {
window.addEventListener('uvLoaded', function(e) {
urlDataProvider = new UV.URLDataProvider(true);
var formattedLocales;
var locales = urlDataProvider.get('locales', '');

if (locales) {
var names = locales.split(',');
formattedLocales = [];

for (var i in names) {
var nameparts = String(names[i]).split(':');
formattedLocales[i] = {name: nameparts[0], label: nameparts[1]};
}

} else {
formattedLocales = [
{
name: 'en-GB'
}
]
}

uv = createUV('#uv', {
root: '.',
iiifResourceUri: urlDataProvider.get('manifest'),
Expand All @@ -53,34 +53,35 @@
rotation: Number(urlDataProvider.get('r', 0)),
xywh: urlDataProvider.get('xywh', ''),
embedded: true,
highlight: urlDataProvider.get('q'),
locales: formattedLocales
}, urlDataProvider);
}, false);
</script>
</head>
</head>
<body>

<div id="uv" class="uv"></div>

<script>
$(function() {

var $UV = $('#uv');

function resize() {
var windowWidth = window.innerWidth;
var windowHeight = window.innerHeight;
$UV.width(windowWidth);
$UV.height(windowHeight);
}

$(window).on('resize' ,function() {
resize();
});

resize();
});

</script>
<script type="text/javascript" src="uv.js"></script>
</body>
Expand Down
10 changes: 9 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_03_09_205554) do
ActiveRecord::Schema.define(version: 2023_06_08_153601) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -173,6 +173,9 @@
t.datetime "last_succeeded_at"
t.string "importerexporter_type", default: "Bulkrax::Importer"
t.integer "import_attempts", default: 0
t.index ["identifier"], name: "index_bulkrax_entries_on_identifier"
t.index ["importerexporter_id", "importerexporter_type"], name: "bulkrax_entries_importerexporter_idx"
t.index ["type"], name: "index_bulkrax_entries_on_type"
end

create_table "bulkrax_exporter_runs", force: :cascade do |t|
Expand Down Expand Up @@ -255,7 +258,9 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "order", default: 0
t.index ["child_id"], name: "index_bulkrax_pending_relationships_on_child_id"
t.index ["importer_run_id"], name: "index_bulkrax_pending_relationships_on_importer_run_id"
t.index ["parent_id"], name: "index_bulkrax_pending_relationships_on_parent_id"
end

create_table "bulkrax_statuses", force: :cascade do |t|
Expand All @@ -269,6 +274,9 @@
t.string "runnable_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["error_class"], name: "index_bulkrax_statuses_on_error_class"
t.index ["runnable_id", "runnable_type"], name: "bulkrax_statuses_runnable_idx"
t.index ["statusable_id", "statusable_type"], name: "bulkrax_statuses_statusable_idx"
end

create_table "checksum_audit_logs", id: :serial, force: :cascade do |t|
Expand Down
4 changes: 2 additions & 2 deletions spec/indexers/hyrax/file_set_indexer_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
work.save
work
end

let(:file_set) { work.file_sets.first }
# Reload the file_set from the database to reset the memoized rdf_type.
let(:file_set) { FileSet.find(work.file_sets.first.id) }
let(:indexer) { Hyrax::FileSetIndexer.new(file_set) }

it 'includes rdf_type_ssim' do
Expand Down

0 comments on commit 58ef40e

Please sign in to comment.