arclight 1.0.0.beta1 → 1.0.0.beta2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1145e9c396f3fb41357ffc7d8e4139e47973369de6d17bc71e2d8b17696bfbb9
4
- data.tar.gz: '0329f7cb492c8e02b4ce48417acaafc291a9db5d7413855e699f1c16d975ef98'
3
+ metadata.gz: b1390f6e3757bd6b696874a8eb4e02c06e31a3c51d03a85bb25880e6536133fd
4
+ data.tar.gz: e55f6e430f6b88974ca1c73b8353fe2869936b43c784027fb7c443eebce94170
5
5
  SHA512:
6
- metadata.gz: dbad57d56b4272b94423f6d733d823f8644020d1c5144297a42866346e2b4e48a0c68691930fa6b949d4c6692fc98023b356428e9bae1957005b50f16999be47
7
- data.tar.gz: b8504eec100f970e296015c329536175be352dd369116310469a5e4bc4dc19cfe3eee2580e83a7206906d427dc5836b328efbeec8f13436f9f783464831acd5f
6
+ metadata.gz: d685048894b2c9ef5821c845c1630e8b375ccb9192cff406a1d58fc38475f07b03055c28c9d1568489a6bbd8c68ba856f359feb780d3a4fe4bba0355e9994d41
7
+ data.tar.gz: 2a3593117293b05a325d140a58f60cdfd34218b40222f7a13ccf7f9c1d62a07a244e08ee894fd5b991efa0d2da6c7521c8fde8e8fb5fa33eec62529e2ca1cb6a
@@ -13,7 +13,7 @@ jobs:
13
13
  matrix:
14
14
  rails_version: [7.0.4]
15
15
  ruby: ['3.0', '3.1', '3.2']
16
- blacklight_version: [8.0.0.beta5]
16
+ blacklight_version: [8.0.0.beta7]
17
17
  env:
18
18
  RAILS_VERSION: ${{ matrix.rails_version }}
19
19
  steps:
@@ -1,4 +1,4 @@
1
- import 'arclight/oembed_viewer'
2
-
3
1
  import Truncate from 'arclight/truncate_controller'
4
2
  Stimulus.register('arclight-truncate', Truncate)
3
+ import Oembed from 'arclight/oembed_controller'
4
+ Stimulus.register('arclight-oembed', Oembed)
@@ -1,23 +1,23 @@
1
- class OembedLoader {
2
- constructor(el) {
3
- this.el = el
1
+ import { Controller } from '@hotwired/stimulus'
2
+
3
+ export default class extends Controller {
4
+ static values = {
5
+ url: String
4
6
  }
5
7
 
6
- load() {
7
- const loadedAttr = this.el.getAttribute('loaded')
8
- const { arclightOembed, arclightOembedUrl, ...extraOembedParams } = this.el.dataset
9
- const extraParams = OembedLoader.normalizeParams(extraOembedParams)
8
+ connect() {
9
+ const loadedAttr = this.element.getAttribute('loaded')
10
10
 
11
11
  if (loadedAttr && loadedAttr === 'loaded') {
12
12
  return
13
13
  }
14
14
 
15
- fetch(arclightOembedUrl)
15
+ fetch(this.urlTarget)
16
16
  .then((response) => response.text())
17
17
  .then((body) => {
18
- const oEmbedEndPoint = OembedLoader.findOEmbedEndPoint(body, extraParams)
18
+ const oEmbedEndPoint = this.findOEmbedEndPoint(body)
19
19
  if (!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
20
- console.warn(`No oEmbed endpoint found in <head> at ${arclightOembedUrl}`)
20
+ console.warn(`No oEmbed endpoint found in <head> at ${this.urlTarget}`)
21
21
  return
22
22
  }
23
23
  this.loadEndPoint(oEmbedEndPoint)
@@ -57,15 +57,8 @@ class OembedLoader {
57
57
  fetch(oEmbedEndPoint)
58
58
  .then((response) => response.json())
59
59
  .then((json) => {
60
- this.el.innerHTML = json.html
61
- this.el.setAttribute('loaded', 'loaded')
60
+ this.element.innerHTML = json.html
61
+ this.element.setAttribute('loaded', 'loaded')
62
62
  })
63
63
  }
64
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
- })
@@ -1,4 +1,4 @@
1
- <%= tag.div(class: 'al-oembed-viewer', 'data-arclight-oembed': true, 'data-arclight-oembed-url': @resource.href) do %>
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
@@ -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/oembed_viewer.js'
39
+ app.config.assets.precompile << 'arclight/oembed_controller.js'
40
40
  app.config.assets.precompile << 'arclight/truncate_controller.js'
41
41
  end
42
42
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arclight
4
- VERSION = '1.0.0.beta1'
4
+ VERSION = '1.0.0.beta2'
5
5
  end
@@ -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/oembed_viewer", to: "arclight/oembed_viewer.js"
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
- inject_into_file 'app/javascript/application.js', after: 'import "blacklight"' do
124
- "\nimport \"arclight\""
125
- end
123
+ append_to_file 'app/javascript/application.js', "\nimport \"arclight\""
126
124
  end
127
125
  end
128
126
  end
@@ -1,4 +1,5 @@
1
1
  $breadcrumb-divider: quote("»");
2
+ $logo-image: image_url('arclight/logo.png') !default;
2
3
  @import 'bootstrap';
3
4
  @import 'blacklight/blacklight';
4
5
  @import 'arclight/application';
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arclight",
3
- "version": "1.0.0-beta1",
3
+ "version": "1.0.0-beta.2",
4
4
  "description": "The frontend for arclight",
5
5
  "main": "app/assets/javascript/arclight/arclight.js",
6
6
  "files": [
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.beta1
4
+ version: 1.0.0.beta2
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-02-08 00:00:00.000000000 Z
14
+ date: 2023-02-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: blacklight
@@ -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/oembed_viewer.js
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
@@ -512,7 +512,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
512
512
  - !ruby/object:Gem::Version
513
513
  version: 1.3.1
514
514
  requirements: []
515
- rubygems_version: 3.3.7
515
+ rubygems_version: 3.3.26
516
516
  signing_key:
517
517
  specification_version: 4
518
518
  summary: ''