Skip to content

Commit

Permalink
🧹 Clean up other overrides
Browse files Browse the repository at this point in the history
This commit is aiming to clean up the rest of the found overrides.
  • Loading branch information
kirkkwang committed Dec 22, 2023
1 parent 5e58fd9 commit 3af409b
Show file tree
Hide file tree
Showing 24 changed files with 159 additions and 204 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/hyrax/app.js.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// OVERRIDE Hyrax v3.5.0 to have a sidebar maximize and minimize based on window size
// OVERRIDE Hyrax v5.0.0rc2 to have a sidebar maximize and minimize based on window size

// Once, javascript is written in a modular format, all initialization
// code should be called from here.
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/hyrax/featured_works.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//OVERRIDE this file to add the selector for featured collections (ff) at the bottom in addition to the selector for featured works (dd)
//OVERRIDE Hyrax 5.0.0rc2 to add the selector for featured collections (ff) at the bottom in addition to the selector for featured works (dd)

// /* find the input element with data-property="order" that is nested under the given node */
function setWeight(node, weight, property) {
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/hyrax/thumbnail_select.es6
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// OVERRIDE: Hyrax 2.9 to use work titles for collection thumbnail select
// OVERRIDE: Hyrax 5.0.0rc2 to use work titles for collection thumbnail select

// Dynamically load the file options into the "Thumbnail" select field.
export default class {
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/hyku/work_show_presenter.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

# OVERRIDE here to add featured collection methods and to delegate collection presenters to the member presenter factory
# OVERRIDE: Hyrax 3.4.0 to add Hyrax IIIF AV
# OVERRIDE: Hyrax 5.0.0rc2 to add Hyrax IIIF AV

module Hyku
class WorkShowPresenter < Hyrax::WorkShowPresenter
Expand All @@ -12,7 +12,7 @@ class WorkShowPresenter < Hyrax::WorkShowPresenter

delegate :title_or_label, :extent, to: :solr_document

# OVERRIDE Hyrax v2.9.0 here to make featured collections work
# OVERRIDE Hyrax v5.0.0rc2 here to make featured collections work
delegate :collection_presenters, to: :member_presenter_factory

# assumes there can only be one doi
Expand Down
28 changes: 0 additions & 28 deletions app/presenters/hyrax/admin/dashboard_presenter.rb

This file was deleted.

18 changes: 18 additions & 0 deletions app/presenters/hyrax/admin/dashboard_presenter_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v5.0.0rc2 to fix user count. by joining roles, we keep the count correct even though there are many users
module Hyrax
module Admin
module DashboardPresenterDecorator
# @return [Fixnum] the number of currently registered users
def user_count(start_date, end_date)
::User.for_repository
.where(guest: false)
.where(created_at: start_date.to_date.beginning_of_day..end_date.to_date.end_of_day)
.count
end
end
end
end

Hyrax::Admin::DashboardPresenter.prepend(Hyrax::Admin::DashboardPresenterDecorator)
58 changes: 0 additions & 58 deletions app/presenters/hyrax/admin/workflow_roles_presenter.rb

This file was deleted.

24 changes: 24 additions & 0 deletions app/presenters/hyrax/admin/workflow_roles_presenter_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v5.0.0rc2 Expand to allow adding groups to workflow roles

module Hyrax
module Admin
# Displays a list of users and their associated workflow roles
module WorkflowRolesPresenterDecorator
# OVERRIDE: New method for adding groups
def groups
Hyrax::Group.all
end

# OVERRIDE: New method for adding groups
def group_presenter_for(group)
agent = group.to_sipity_agent
return unless agent
Hyrax::Admin::WorkflowRolesPresenter::AgentPresenter.new(agent)
end
end
end
end

Hyrax::Admin::WorkflowRolesPresenter.prepend(Hyrax::Admin::WorkflowRolesPresenterDecorator)
22 changes: 7 additions & 15 deletions app/presenters/hyrax/collection_presenter_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v3.4.1
# OVERRIDE Hyrax v5.0.0rc2
# - Add collection methods to collection presenter and override to return
# full banner_file data, rather than only download path to file.
# - Alter permissions-related behavior.
# Terms is the list of fields displayed by app/views/collections/_show_descriptions.html.erb
module Hyrax
module CollectionPresenterDecorator
def self.decorate(base)
base.prepend(self)
extend ActiveSupport::Concern

base.redefine_singleton_method(:terms) do
class_methods do
def terms
# OVERRIDE Hyrax - removed size
%i[total_items
resource_type
creator contributor
keyword license
publisher
date_created
subject language
identifier
based_near
related_url]
super - [:size]
end
end

Expand All @@ -33,6 +24,7 @@ def create_any_work_types?
create_work_presenter.authorized_models.any?
end

# OVERRIDE Hyrax - remove size
def [](key)
case key
when :total_items
Expand Down Expand Up @@ -109,4 +101,4 @@ def user_can_feature_collection?
end
end

Hyrax::CollectionPresenterDecorator.decorate(Hyrax::CollectionPresenter)
Hyrax::CollectionPresenter.prepend(Hyrax::CollectionPresenterDecorator)
2 changes: 1 addition & 1 deletion app/presenters/hyrax/iiif_manifest_presenter_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE Hyrax 3.4.0 to check the site's ssl_configured when setting protocols
# OVERRIDE Hyrax v5.0.0rc2 to check the site's ssl_configured when setting protocols
module Hyrax
module IiifManifestPresenterDecorator
attr_writer :iiif_version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE: Hyrax 3.4.1 adds filesets to search to allow full text search results on the Collection show pages
# OVERRIDE: Hyrax 5.0.0rc2 adds filesets to search to allow full text search results on the Collection show pages
module Hyrax
module CollectionMemberSearchBuilderDecorator
Hyrax::CollectionMemberSearchBuilder.default_processor_chain += [:show_works_or_works_that_contain_files]
Expand Down
36 changes: 36 additions & 0 deletions app/services/hyrax/file_set_derivatives_service_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

# OVERRIDE Hyrax v5.0.0rc2 to increase the size of thumbnails

module Hyrax
module FileSetDerivativesServiceDecorator
def create_pdf_derivatives(filename)
Hydra::Derivatives::PdfDerivatives.create(filename, outputs: [{ label: :thumbnail,
format: 'jpg',
size: '676x986',
url: derivative_url('thumbnail'),
layer: 0 }])
extract_full_text(filename, uri)
end

def create_office_document_derivatives(filename)
Hydra::Derivatives::DocumentDerivatives.create(filename, outputs: [{ label: :thumbnail,
format: 'jpg',
size: '600x450>',
url: derivative_url('thumbnail'),
layer: 0 }])
extract_full_text(filename, uri)
end

def create_image_derivatives(filename)
# We're asking for layer 0, because otherwise pyramidal tiffs flatten all the layers together into the thumbnail
Hydra::Derivatives::ImageDerivatives.create(filename, outputs: [{ label: :thumbnail,
format: 'jpg',
size: '600x450>',
url: derivative_url('thumbnail'),
layer: 0 }])
end
end
end

Hyrax::FileSetDerivativesService.prepend(Hyrax::FileSetDerivativesServiceDecorator)
62 changes: 0 additions & 62 deletions config/initializers/file_set_derivatives_overrides.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/active_fedora/solr_service_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# OVERRIDE: class ActiveFedora::SolrService from Fedora 12.1.1
# OVERRIDE: class ActiveFedora::SolrService from Fedora v14.0.1
module ActiveFedora
module SolrServiceDecorator
# Get the count of records that match the query
Expand Down
28 changes: 0 additions & 28 deletions lib/hydra/derivatives/processors/image_decorator.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# frozen_string_literal: true

# OVERRIDE IIIFManifest v0.5.0 to use the parent's title as the label instead of the filename
# OVERRIDE IIIFManifest v1.3.1 to use the parent's title as the label instead of the filename

module IIIFManifest
module ManifestBuilderDecorator
module CanvasBuilderDecorator
private

def apply_record_properties
canvas['@id'] = path
canvas.label = record['parent_title_tesim']&.first || record.to_s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ module IIIFManifest
module V3
module ManifestBuilderDecorator
module CanvasBuilderDecorator
private

def apply_record_properties
super
canvas.label = (ManifestBuilder.language_map(record['parent_title_tesim']&.first || record.to_s) if record.to_s.present?)
Expand Down
2 changes: 1 addition & 1 deletion lib/oai/provider/model_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module OAI
module Provider
module ModelDecorator
# Map Qualified Dublin Core (Terms) fields to PALNI/PALCI fields
# # OVERRIDE OAI v1.2.1 to map Qualified Dublin Core (Terms) fields to PALNI/PALCI fields
# rubocop:disable Metrics/MethodLength
def map_oai_hyku
{
Expand Down
Loading

0 comments on commit 3af409b

Please sign in to comment.