arclight 1.0.0.beta1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +0 -1
- data/.rubocop.yml +36 -4
- data/.rubocop_todo.yml +39 -44
- data/CONTRIBUTORS.md +1 -1
- data/README.md +2 -0
- data/app/assets/javascripts/arclight/arclight.js +2 -2
- data/app/assets/javascripts/arclight/oembed_controller.js +58 -0
- data/app/components/arclight/oembed_viewer_component.html.erb +1 -1
- data/app/components/arclight/search_result_component.rb +0 -6
- data/app/components/arclight/sidebar_component.html.erb +1 -1
- data/arclight.gemspec +5 -4
- data/lib/arclight/engine.rb +1 -1
- data/lib/arclight/version.rb +1 -1
- data/lib/generators/arclight/install_generator.rb +2 -4
- data/lib/generators/arclight/templates/arclight.scss +1 -0
- data/package.json +3 -3
- metadata +14 -12
- data/app/assets/javascripts/arclight/oembed_viewer.js +0 -71
- /data/app/assets/images/{blacklight → arclight}/logo.png +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8dc036f2f88f3c446ea37d4e430da4a555041c6ac63262ad062853ae91ed2fac
|
|
4
|
+
data.tar.gz: 1c07fab78cbc66efd7c35e2ccc6b0767350143a8e5c0a1565cbf383096763ba1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 490d571aa3e06bd5f9e65042c69abc66a5f96b3f6d48dfcd5021d88807a5b2176d3a5e1475ca69a2d52ff292c1ae4df88fdcccc6a85e002deb583b2cb29eed19
|
|
7
|
+
data.tar.gz: 267f8e127ed5222fbda4106444f65886f0742d664bbe3e9e3f453f1625577cec8dd139b9021ddc6c9812bb369cd4facc8cc9149a585faa34b44498ffcdc2fc49
|
data/.github/workflows/ruby.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -200,9 +200,9 @@ RSpec/SubjectDeclaration: # new in 2.5
|
|
|
200
200
|
Enabled: true
|
|
201
201
|
RSpec/VerifiedDoubleReference: # new in 2.10.0
|
|
202
202
|
Enabled: true
|
|
203
|
-
|
|
203
|
+
Capybara/SpecificFinders: # new in 2.13
|
|
204
204
|
Enabled: true
|
|
205
|
-
|
|
205
|
+
Capybara/SpecificMatcher: # new in 2.12
|
|
206
206
|
Enabled: true
|
|
207
207
|
RSpec/FactoryBot/SyntaxMethods: # new in 2.7
|
|
208
208
|
Enabled: true
|
|
@@ -314,9 +314,9 @@ Style/RedundantStringEscape: # new in 1.37
|
|
|
314
314
|
Enabled: true
|
|
315
315
|
RSpec/SortMetadata: # new in 2.14
|
|
316
316
|
Enabled: true
|
|
317
|
-
|
|
317
|
+
Capybara/NegationMatcher: # new in 2.14
|
|
318
318
|
Enabled: true
|
|
319
|
-
|
|
319
|
+
Capybara/SpecificActions: # new in 2.14
|
|
320
320
|
Enabled: true
|
|
321
321
|
RSpec/FactoryBot/ConsistentParenthesesStyle: # new in 2.14
|
|
322
322
|
Enabled: false # https://github.com/rspec/rspec-rails/issues/2635
|
|
@@ -327,4 +327,36 @@ Rails/ActionOrder: # new in 2.17
|
|
|
327
327
|
Rails/IgnoredColumnsAssignment: # new in 2.17
|
|
328
328
|
Enabled: true
|
|
329
329
|
Rails/WhereNotWithMultipleConditions: # new in 2.17
|
|
330
|
+
Enabled: true
|
|
331
|
+
Gemspec/DevelopmentDependencies: # new in 1.44
|
|
332
|
+
Enabled: true
|
|
333
|
+
Lint/UselessRescue: # new in 1.43
|
|
334
|
+
Enabled: true
|
|
335
|
+
Style/ArrayIntersect: # new in 1.40
|
|
336
|
+
Enabled: true
|
|
337
|
+
Style/ComparableClamp: # new in 1.44
|
|
338
|
+
Enabled: true
|
|
339
|
+
Style/ConcatArrayLiterals: # new in 1.41
|
|
340
|
+
Enabled: true
|
|
341
|
+
Style/MapToSet: # new in 1.42
|
|
342
|
+
Enabled: true
|
|
343
|
+
Style/MinMaxComparison: # new in 1.42
|
|
344
|
+
Enabled: true
|
|
345
|
+
Style/RedundantConstantBase: # new in 1.40
|
|
346
|
+
Enabled: true
|
|
347
|
+
Style/RedundantDoubleSplatHashBraces: # new in 1.41
|
|
348
|
+
Enabled: true
|
|
349
|
+
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
|
|
350
|
+
Enabled: true
|
|
351
|
+
Capybara/MatchStyle: # new in 2.17
|
|
352
|
+
Enabled: true
|
|
353
|
+
RSpec/DuplicatedMetadata: # new in 2.16
|
|
354
|
+
Enabled: true
|
|
355
|
+
RSpec/PendingWithoutReason: # new in 2.16
|
|
356
|
+
Enabled: true
|
|
357
|
+
RSpec/FactoryBot/FactoryNameStyle: # new in 2.16
|
|
358
|
+
Enabled: false # https://github.com/rubocop/rubocop-rspec/issues/1587
|
|
359
|
+
RSpec/Rails/MinitestAssertions: # new in 2.17
|
|
360
|
+
Enabled: true
|
|
361
|
+
Rails/ResponseParsedBody: # new in 2.18
|
|
330
362
|
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
# This configuration was generated by
|
|
2
2
|
# `rubocop --auto-gen-config`
|
|
3
|
-
# on
|
|
3
|
+
# on 2023-02-27 17:35:23 UTC using RuboCop version 1.46.0.
|
|
4
4
|
# The point is for the user to remove these configuration records
|
|
5
5
|
# one by one as the offenses are removed from the code base.
|
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
8
8
|
|
|
9
|
-
# Offense count:
|
|
10
|
-
# Configuration parameters:
|
|
9
|
+
# Offense count: 10
|
|
10
|
+
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
|
|
11
|
+
# SupportedStyles: Gemfile, gems.rb, gemspec
|
|
12
|
+
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
|
|
13
|
+
Gemspec/DevelopmentDependencies:
|
|
14
|
+
Exclude:
|
|
15
|
+
- 'arclight.gemspec'
|
|
16
|
+
|
|
17
|
+
# Offense count: 1
|
|
18
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
|
11
19
|
Metrics/AbcSize:
|
|
12
20
|
Max: 19
|
|
13
21
|
|
|
14
|
-
# Offense count:
|
|
15
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
|
22
|
+
# Offense count: 1
|
|
23
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
16
24
|
Metrics/CyclomaticComplexity:
|
|
17
25
|
Max: 8
|
|
18
26
|
|
|
19
|
-
# Offense count:
|
|
20
|
-
# Configuration parameters: CountComments, CountAsOne,
|
|
27
|
+
# Offense count: 3
|
|
28
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
|
21
29
|
Metrics/MethodLength:
|
|
22
|
-
Max:
|
|
30
|
+
Max: 11
|
|
23
31
|
|
|
24
|
-
# Offense count:
|
|
25
|
-
# Configuration parameters: AllowedMethods, AllowedPatterns
|
|
32
|
+
# Offense count: 2
|
|
33
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
26
34
|
Metrics/PerceivedComplexity:
|
|
27
35
|
Max: 9
|
|
28
36
|
|
|
29
|
-
# Offense count:
|
|
30
|
-
# Configuration parameters: ForbiddenDelimiters.
|
|
31
|
-
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
|
32
|
-
Naming/HeredocDelimiterNaming:
|
|
33
|
-
Exclude:
|
|
34
|
-
- 'spec/features/autocomplete_spec.rb'
|
|
35
|
-
|
|
36
|
-
# Offense count: 80
|
|
37
|
+
# Offense count: 60
|
|
37
38
|
# Configuration parameters: Prefixes, AllowedPatterns.
|
|
38
39
|
# Prefixes: when, with, without
|
|
39
40
|
RSpec/ContextWording:
|
|
@@ -47,38 +48,32 @@ RSpec/DescribedClass:
|
|
|
47
48
|
Exclude:
|
|
48
49
|
- 'spec/presenters/arclight/show_presenter_spec.rb'
|
|
49
50
|
|
|
50
|
-
# Offense count:
|
|
51
|
+
# Offense count: 60
|
|
51
52
|
# Configuration parameters: CountAsOne.
|
|
52
53
|
RSpec/ExampleLength:
|
|
53
54
|
Max: 49
|
|
54
55
|
|
|
55
|
-
# Offense count:
|
|
56
|
-
RSpec/ExpectInHook:
|
|
57
|
-
Exclude:
|
|
58
|
-
- 'spec/helpers/arclight_helper_spec.rb'
|
|
59
|
-
|
|
60
|
-
# Offense count: 1
|
|
61
|
-
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
|
|
62
|
-
# Include: **/*_spec*rb*, **/spec/**/*
|
|
63
|
-
RSpec/FilePath:
|
|
64
|
-
Exclude:
|
|
65
|
-
- 'spec/lib/arclight/viewers/oembed_spec.rb'
|
|
66
|
-
|
|
67
|
-
# Offense count: 132
|
|
56
|
+
# Offense count: 112
|
|
68
57
|
RSpec/MultipleExpectations:
|
|
69
|
-
Max:
|
|
58
|
+
Max: 22
|
|
70
59
|
|
|
71
|
-
# Offense count:
|
|
60
|
+
# Offense count: 37
|
|
72
61
|
# Configuration parameters: AllowSubject.
|
|
73
62
|
RSpec/MultipleMemoizedHelpers:
|
|
74
63
|
Max: 10
|
|
75
64
|
|
|
76
|
-
# Offense count:
|
|
65
|
+
# Offense count: 22
|
|
77
66
|
# Configuration parameters: AllowedGroups.
|
|
78
67
|
RSpec/NestedGroups:
|
|
79
68
|
Max: 5
|
|
80
69
|
|
|
81
|
-
# Offense count:
|
|
70
|
+
# Offense count: 2
|
|
71
|
+
RSpec/PendingWithoutReason:
|
|
72
|
+
Exclude:
|
|
73
|
+
- 'spec/features/document_tools_spec.rb'
|
|
74
|
+
- 'spec/features/google_form_request_spec.rb'
|
|
75
|
+
|
|
76
|
+
# Offense count: 5
|
|
82
77
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
83
78
|
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
|
84
79
|
# SupportedStyles: inflected, explicit
|
|
@@ -87,13 +82,7 @@ RSpec/PredicateMatcher:
|
|
|
87
82
|
- 'spec/helpers/arclight_helper_spec.rb'
|
|
88
83
|
- 'spec/lib/arclight/year_range_spec.rb'
|
|
89
84
|
|
|
90
|
-
# Offense count:
|
|
91
|
-
RSpec/StubbedMock:
|
|
92
|
-
Exclude:
|
|
93
|
-
- 'spec/helpers/arclight_helper_spec.rb'
|
|
94
|
-
- 'spec/lib/arclight/viewer_spec.rb'
|
|
95
|
-
|
|
96
|
-
# Offense count: 2
|
|
85
|
+
# Offense count: 1
|
|
97
86
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
98
87
|
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
|
99
88
|
Rails/Blank:
|
|
@@ -112,7 +101,7 @@ Rails/OutputSafety:
|
|
|
112
101
|
Exclude:
|
|
113
102
|
- 'app/helpers/arclight/field_config_helpers.rb'
|
|
114
103
|
|
|
115
|
-
# Offense count:
|
|
104
|
+
# Offense count: 6
|
|
116
105
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
117
106
|
# Configuration parameters: Include.
|
|
118
107
|
# Include: **/Rakefile, **/*.rake
|
|
@@ -125,3 +114,9 @@ Rails/RakeEnvironment:
|
|
|
125
114
|
Security/Open:
|
|
126
115
|
Exclude:
|
|
127
116
|
- 'lib/tasks/index.rake'
|
|
117
|
+
|
|
118
|
+
# Offense count: 1
|
|
119
|
+
# This cop supports safe autocorrection (--autocorrect).
|
|
120
|
+
Style/RedundantConstantBase:
|
|
121
|
+
Exclude:
|
|
122
|
+
- 'spec/spec_helper.rb'
|
data/CONTRIBUTORS.md
CHANGED
|
@@ -45,7 +45,7 @@ Individual project contributors include ([emoji key](https://allcontributors.org
|
|
|
45
45
|
</tr>
|
|
46
46
|
<tr>
|
|
47
47
|
<td align="center"><a href="https://github.com/gordonleacock"><img src="https://avatars3.githubusercontent.com/u/12927191?v=4" width="125px;" alt="Gordon Leacock"/><br /><sub><b>Gordon Leacock</b></sub></a><br /><a href="https://github.com/projectblacklight/arclight/commits?author=gordonleacock" title="Code">💻</a> <a href="https://github.com/projectblacklight/arclight/commits?author=gordonleacock" title="Documentation">📖</a></td>
|
|
48
|
-
<td align="center"><a href="https://matienzo.org/"><img src="https://avatars0.githubusercontent.com/u/73732?v=4" width="125px;" alt="
|
|
48
|
+
<td align="center"><a href="https://matienzo.org/"><img src="https://avatars0.githubusercontent.com/u/73732?v=4" width="125px;" alt="María A. Matienzo"/><br /><sub><b>María A. Matienzo</b></sub></a><br /><a href="#projectManagement-anarchivist" title="Project Management">📆</a> <a href="#business-anarchivist" title="Business development">💼</a> <a href="#analysis-anarchivist" title="Functional requirements and related research">🔬</a> <a href="#productOwner-anarchivist" title="Product owner">🗺</a></td>
|
|
49
49
|
<td align="center"><a href="https://github.com/archivistsarah"><img src="https://avatars0.githubusercontent.com/u/25084902?v=4" width="125px;" alt="Sarah Newhouse"/><br /><sub><b>Sarah Newhouse</b></sub></a><br /><a href="#analysis-archivistsarah" title="Functional requirements and related research">🔬</a></td>
|
|
50
50
|
<td align="center"><a href="https://github.com/grepcats"><img src="https://avatars0.githubusercontent.com/u/7513448?v=4" width="125px;" alt="Kayla Ondracek"/><br /><sub><b>Kayla Ondracek</b></sub></a><br /><a href="#analysis-grepcats" title="Functional requirements and related research">🔬</a></td>
|
|
51
51
|
<td align="center"><a href="https://github.com/djpillen"><img src="https://avatars3.githubusercontent.com/u/11635158?v=4" width="125px;" alt="Dallas Pillen"/><br /><sub><b>Dallas Pillen</b></sub></a><br /><a href="https://github.com/projectblacklight/arclight/commits?author=djpillen" title="Code">💻</a> <a href="#userTesting-djpillen" title="User Testing">📓</a></td>
|
data/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/arclight)
|
|
2
|
+
[](https://badge.fury.io/js/arclight)
|
|
1
3
|

|
|
2
4
|
[](CONTRIBUTORS.md)
|
|
3
5
|
[](https://codeclimate.com/github/projectblacklight/arclight/coverage)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus'
|
|
2
|
+
|
|
3
|
+
export default class OembedController extends Controller {
|
|
4
|
+
static values = {
|
|
5
|
+
url: String
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
connect() {
|
|
9
|
+
const loadedAttr = this.element.getAttribute('loaded')
|
|
10
|
+
|
|
11
|
+
if (loadedAttr && loadedAttr === 'loaded') {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
fetch(this.urlValue)
|
|
16
|
+
.then((response) => {
|
|
17
|
+
if (response.ok) return response.text()
|
|
18
|
+
throw new Error(`HTTP error, status = ${response.status}`)
|
|
19
|
+
})
|
|
20
|
+
.then((body) => {
|
|
21
|
+
const oEmbedEndPoint = this.findOEmbedEndPoint(body)
|
|
22
|
+
if (!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
|
|
23
|
+
console.warn(`No oEmbed endpoint found in <head> at ${this.urlValue}`)
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
this.loadEndPoint(oEmbedEndPoint)
|
|
27
|
+
}).catch(error => {
|
|
28
|
+
console.error(error)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// We are choosing not to make this class static so that downstream classes
|
|
33
|
+
// can override it and access values to populate extraParams.
|
|
34
|
+
// E.g. https://github.com/sul-dlss/vt-arclight/blob/main/app/javascript/controllers/sul_embed_controller.js
|
|
35
|
+
findOEmbedEndPoint(body, extraParams = {}) { // eslint-disable-line class-methods-use-this
|
|
36
|
+
// Parse out link elements so image assets are not loaded
|
|
37
|
+
const template = document.createElement('template')
|
|
38
|
+
template.innerHTML = body.match(/<link .*>/g).join('')
|
|
39
|
+
|
|
40
|
+
// Look for a link element containing the oEmbed endpoint; bail out if none
|
|
41
|
+
const endpoint = template.content.querySelector('link[rel="alternate"][type="application/json+oembed"]')
|
|
42
|
+
?.getAttribute('href')
|
|
43
|
+
if (!endpoint) return ''
|
|
44
|
+
|
|
45
|
+
// Serialize any extra params and append them to the endpoint
|
|
46
|
+
const qs = new URLSearchParams(extraParams).toString()
|
|
47
|
+
return `${endpoint}&${qs}`
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
loadEndPoint(oEmbedEndPoint) {
|
|
51
|
+
fetch(oEmbedEndPoint)
|
|
52
|
+
.then((response) => response.json())
|
|
53
|
+
.then((json) => {
|
|
54
|
+
this.element.innerHTML = json.html
|
|
55
|
+
this.element.setAttribute('loaded', 'loaded')
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%= tag.div(class: 'al-oembed-viewer',
|
|
1
|
+
<%= tag.div(class: 'al-oembed-viewer', data: { controller: 'arclight-oembed', arclight_oembed_url_value: @resource.href }) do %>
|
|
2
2
|
<div class="al-digital-object">
|
|
3
3
|
<%= link_to(@resource.label, @resource.href) %>
|
|
4
4
|
</div>
|
|
@@ -7,12 +7,6 @@ module Arclight
|
|
|
7
7
|
class SearchResultComponent < Blacklight::DocumentComponent
|
|
8
8
|
attr_reader :document
|
|
9
9
|
|
|
10
|
-
# We need to initialize the view component counter variable
|
|
11
|
-
# See https://viewcomponent.org/guide/collections.html#collection-counter
|
|
12
|
-
def initialize(search_result_counter: nil, **kwargs)
|
|
13
|
-
super
|
|
14
|
-
end
|
|
15
|
-
|
|
16
10
|
def compact?
|
|
17
11
|
presenter.view_config.key.to_s == 'compact'
|
|
18
12
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div class="offcanvas-lg offcanvas-start p-3 p-lg-1" tabindex="-1" id="sidebar">
|
|
2
2
|
<%= collection_context %>
|
|
3
|
-
<%= render 'show_tools' %>
|
|
3
|
+
<%= render 'show_tools', document: document %>
|
|
4
4
|
<%= collection_sidebar %>
|
|
5
5
|
<div id="collection-context" class="sidebar-section">
|
|
6
6
|
<h2><%= t('arclight.views.show.has_content') %></h2>
|
data/arclight.gemspec
CHANGED
|
@@ -10,10 +10,11 @@ Gem::Specification.new do |spec|
|
|
|
10
10
|
spec.authors = ['Darren Hardy', 'Jessie Keck', 'Gordon Leacock', 'Jack Reed']
|
|
11
11
|
spec.email = ['drh@stanford.edu', 'jessie.keck@gmail.com', 'gordonl@umich.edu', 'phillipjreed@gmail.com']
|
|
12
12
|
|
|
13
|
-
spec.summary = ''
|
|
13
|
+
spec.summary = 'A Blacklight-based environment to support discovery and delivery for archives and special collections'
|
|
14
14
|
spec.description = ''
|
|
15
|
-
spec.homepage = 'https://
|
|
16
|
-
spec.
|
|
15
|
+
spec.homepage = 'https://library.stanford.edu/projects/arclight'
|
|
16
|
+
spec.metadata = { 'source_code_uri' => 'https://github.com/projectblacklight/arclight' }
|
|
17
|
+
spec.license = 'Apache-2.0'
|
|
17
18
|
|
|
18
19
|
spec.required_ruby_version = '>= 3.0.0'
|
|
19
20
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
@@ -23,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
23
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
25
|
spec.require_paths = ['lib']
|
|
25
26
|
|
|
26
|
-
spec.add_dependency 'blacklight', '>= 8.0.0
|
|
27
|
+
spec.add_dependency 'blacklight', '>= 8.0.0', '< 9'
|
|
27
28
|
spec.add_dependency 'gretel'
|
|
28
29
|
spec.add_dependency 'rails', '~> 7.0'
|
|
29
30
|
spec.add_dependency 'traject', '~> 3.0'
|
data/lib/arclight/engine.rb
CHANGED
|
@@ -36,7 +36,7 @@ module Arclight
|
|
|
36
36
|
|
|
37
37
|
initializer 'arclight.assets', before: 'assets' do |app|
|
|
38
38
|
app.config.assets.precompile << 'arclight/arclight.js'
|
|
39
|
-
app.config.assets.precompile << 'arclight/
|
|
39
|
+
app.config.assets.precompile << 'arclight/oembed_controller.js'
|
|
40
40
|
app.config.assets.precompile << 'arclight/truncate_controller.js'
|
|
41
41
|
end
|
|
42
42
|
|
data/lib/arclight/version.rb
CHANGED
|
@@ -114,15 +114,13 @@ module Arclight
|
|
|
114
114
|
append_to_file 'config/importmap.rb', <<~RUBY
|
|
115
115
|
pin "arclight", to: "arclight/arclight.js"
|
|
116
116
|
# TODO: We may be able to move these to a single importmap for arclight.
|
|
117
|
-
pin "arclight/
|
|
117
|
+
pin "arclight/oembed_controller", to: "arclight/oembed_controller.js"
|
|
118
118
|
pin "arclight/truncate_controller", to: "arclight/truncate_controller.js"
|
|
119
119
|
RUBY
|
|
120
120
|
end
|
|
121
121
|
|
|
122
122
|
def import_arclight_javascript
|
|
123
|
-
|
|
124
|
-
"\nimport \"arclight\""
|
|
125
|
-
end
|
|
123
|
+
append_to_file 'app/javascript/application.js', "\nimport \"arclight\""
|
|
126
124
|
end
|
|
127
125
|
end
|
|
128
126
|
end
|
data/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arclight",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The frontend for arclight",
|
|
5
5
|
"main": "app/assets/javascript/arclight/arclight.js",
|
|
6
6
|
"files": [
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "
|
|
21
|
+
"url": "https://github.com/projectblacklight/arclight.git"
|
|
22
22
|
},
|
|
23
23
|
"author": "",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/projectblacklight/arclight/issues"
|
|
27
27
|
},
|
|
28
|
-
"homepage": "https://
|
|
28
|
+
"homepage": "https://library.stanford.edu/projects/arclight"
|
|
29
29
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: arclight
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Darren Hardy
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: exe
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date: 2023-
|
|
14
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: blacklight
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - ">="
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 8.0.0
|
|
22
|
+
version: 8.0.0
|
|
23
23
|
- - "<"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: '9'
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 8.0.0
|
|
32
|
+
version: 8.0.0
|
|
33
33
|
- - "<"
|
|
34
34
|
- !ruby/object:Gem::Version
|
|
35
35
|
version: '9'
|
|
@@ -310,6 +310,7 @@ files:
|
|
|
310
310
|
- LICENSE.txt
|
|
311
311
|
- README.md
|
|
312
312
|
- Rakefile
|
|
313
|
+
- app/assets/images/arclight/logo.png
|
|
313
314
|
- app/assets/images/blacklight/bookmark.svg
|
|
314
315
|
- app/assets/images/blacklight/collection.svg
|
|
315
316
|
- app/assets/images/blacklight/compact.svg
|
|
@@ -318,14 +319,13 @@ files:
|
|
|
318
319
|
- app/assets/images/blacklight/file.svg
|
|
319
320
|
- app/assets/images/blacklight/folder.svg
|
|
320
321
|
- app/assets/images/blacklight/list.svg
|
|
321
|
-
- app/assets/images/blacklight/logo.png
|
|
322
322
|
- app/assets/images/blacklight/minus.svg
|
|
323
323
|
- app/assets/images/blacklight/online.svg
|
|
324
324
|
- app/assets/images/blacklight/pdf.svg
|
|
325
325
|
- app/assets/images/blacklight/plus.svg
|
|
326
326
|
- app/assets/images/blacklight/repository.svg
|
|
327
327
|
- app/assets/javascripts/arclight/arclight.js
|
|
328
|
-
- app/assets/javascripts/arclight/
|
|
328
|
+
- app/assets/javascripts/arclight/oembed_controller.js
|
|
329
329
|
- app/assets/javascripts/arclight/truncate_controller.js
|
|
330
330
|
- app/assets/stylesheets/arclight/application.scss
|
|
331
331
|
- app/assets/stylesheets/arclight/modules/collection_search.scss
|
|
@@ -493,10 +493,11 @@ files:
|
|
|
493
493
|
- solr/conf/xslt/luke.xsl
|
|
494
494
|
- tasks/arclight.rake
|
|
495
495
|
- template.rb
|
|
496
|
-
homepage: https://
|
|
496
|
+
homepage: https://library.stanford.edu/projects/arclight
|
|
497
497
|
licenses:
|
|
498
498
|
- Apache-2.0
|
|
499
|
-
metadata:
|
|
499
|
+
metadata:
|
|
500
|
+
source_code_uri: https://github.com/projectblacklight/arclight
|
|
500
501
|
post_install_message:
|
|
501
502
|
rdoc_options: []
|
|
502
503
|
require_paths:
|
|
@@ -508,12 +509,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
508
509
|
version: 3.0.0
|
|
509
510
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
510
511
|
requirements:
|
|
511
|
-
- - "
|
|
512
|
+
- - ">="
|
|
512
513
|
- !ruby/object:Gem::Version
|
|
513
|
-
version:
|
|
514
|
+
version: '0'
|
|
514
515
|
requirements: []
|
|
515
|
-
rubygems_version: 3.3.
|
|
516
|
+
rubygems_version: 3.3.26
|
|
516
517
|
signing_key:
|
|
517
518
|
specification_version: 4
|
|
518
|
-
summary:
|
|
519
|
+
summary: A Blacklight-based environment to support discovery and delivery for archives
|
|
520
|
+
and special collections
|
|
519
521
|
test_files: []
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
class OembedLoader {
|
|
2
|
-
constructor(el) {
|
|
3
|
-
this.el = el
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
load() {
|
|
7
|
-
const loadedAttr = this.el.getAttribute('loaded')
|
|
8
|
-
const { arclightOembed, arclightOembedUrl, ...extraOembedParams } = this.el.dataset
|
|
9
|
-
const extraParams = OembedLoader.normalizeParams(extraOembedParams)
|
|
10
|
-
|
|
11
|
-
if (loadedAttr && loadedAttr === 'loaded') {
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
fetch(arclightOembedUrl)
|
|
16
|
-
.then((response) => response.text())
|
|
17
|
-
.then((body) => {
|
|
18
|
-
const oEmbedEndPoint = OembedLoader.findOEmbedEndPoint(body, extraParams)
|
|
19
|
-
if (!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
|
|
20
|
-
console.warn(`No oEmbed endpoint found in <head> at ${arclightOembedUrl}`)
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
this.loadEndPoint(oEmbedEndPoint)
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Convert data-arclight-oembed-* attributes to URL parameters for the viewer
|
|
28
|
-
static normalizeParams(attributes) {
|
|
29
|
-
return Object.keys(attributes).reduce((acc, attribute) => {
|
|
30
|
-
// Reverse data attribute name conversion. See:
|
|
31
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset#name_conversion
|
|
32
|
-
const parameterName = attribute.replace('arclightOembed', '')
|
|
33
|
-
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
|
34
|
-
.toLowerCase()
|
|
35
|
-
|
|
36
|
-
acc[parameterName] = attributes[attribute]
|
|
37
|
-
return acc
|
|
38
|
-
}, {})
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static findOEmbedEndPoint(body, extraParams = {}) {
|
|
42
|
-
// Parse out link elements so image assets are not loaded
|
|
43
|
-
const template = document.createElement('template')
|
|
44
|
-
template.innerHTML = body.match(/<link .*>/g).join('')
|
|
45
|
-
|
|
46
|
-
// Look for a link element containing the oEmbed endpoint; bail out if none
|
|
47
|
-
const endpoint = template.content.querySelector('link[rel="alternate"][type="application/json+oembed"]')
|
|
48
|
-
?.getAttribute('href')
|
|
49
|
-
if (!endpoint) return ''
|
|
50
|
-
|
|
51
|
-
// Serialize any extra params and append them to the endpoint
|
|
52
|
-
const qs = new URLSearchParams(extraParams).toString()
|
|
53
|
-
return `${endpoint}&${qs}`
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
loadEndPoint(oEmbedEndPoint) {
|
|
57
|
-
fetch(oEmbedEndPoint)
|
|
58
|
-
.then((response) => response.json())
|
|
59
|
-
.then((json) => {
|
|
60
|
-
this.el.innerHTML = json.html
|
|
61
|
-
this.el.setAttribute('loaded', 'loaded')
|
|
62
|
-
})
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
Blacklight.onLoad(function () {
|
|
67
|
-
document.querySelectorAll('[data-arclight-oembed="true"]').forEach((element) => {
|
|
68
|
-
const loader = new OembedLoader(element)
|
|
69
|
-
loader.load()
|
|
70
|
-
})
|
|
71
|
-
})
|
|
File without changes
|