Skip to content

Commit

Permalink
🎁 Modify labels in UV for V3 manifests
Browse files Browse the repository at this point in the history
This commit will add the same treatment as we have for V2 manifests to
V3 manifests. This will allow the UV to add a more human readable label
to the pages.

Ref:
  - https://github.com/scientist-softserv/adventist-dl/issues/628
  • Loading branch information
kirkkwang committed Nov 1, 2023
1 parent 3919082 commit b0f2c44
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/iiif_manifest/v3/manifest_builder/canvas_builder_decorator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# frozen_string_literal: true

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

module IIIFManifest
module V3
module ManifestBuilderDecorator
module CanvasBuilderDecorator
def apply_record_properties
super
canvas.label = if record.to_s.present?
ManifestBuilder.language_map(record['parent_title_tesim']&.first || record.to_s)
end
end
end
end
end
end

IIIFManifest::V3::ManifestBuilder.prepend(IIIFManifest::V3::ManifestBuilderDecorator)
IIIFManifest::V3::ManifestBuilder::CanvasBuilder.prepend(IIIFManifest::V3::ManifestBuilder::CanvasBuilderDecorator)

0 comments on commit b0f2c44

Please sign in to comment.