blacklight-spotlight 5.0.0.pre.alpha1 → 5.0.0.pre.alpha2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ <p>I am in the component</p>
2
+ <%= content_tag heading_tag, text %>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module Blocks
5
+ # Sir Trevor Heading Block
6
+ class HeadingBlockComponent < ViewComponent::Base
7
+ def initialize(heading_block:)
8
+ @heading_block = heading_block
9
+ super
10
+ end
11
+
12
+ attr_reader :heading_block
13
+
14
+ delegate :level, to: :heading_block
15
+ delegate :format, to: :heading_block
16
+ delegate :text, to: :heading_block
17
+
18
+ def heading_tag
19
+ return "h#{level}" if html? && valid_level?
20
+
21
+ # h2 was Spotlight's default heading tag for 10+ years.
22
+ 'h2'
23
+ end
24
+
25
+ private
26
+
27
+ def valid_level?
28
+ level.to_i.between?(1, 6)
29
+ end
30
+
31
+ def html?
32
+ heading_block.format.to_s == 'html'
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,3 +1,5 @@
1
+ import OpenSeadragon from 'openseadragon';
2
+
1
3
  export default class {
2
4
  connect() {
3
5
  $('.zpr-link').on('click', function() {
@@ -18,9 +18,7 @@ module SirTrevorRails
18
18
  send(:[], :format).present? ? send(:[], :format).to_sym : DEFAULT_FORMAT
19
19
  end
20
20
 
21
- def supports_alt_text?
22
- self.class.supports_alt_text?
23
- end
21
+ delegate :supports_alt_text?, to: :class
24
22
 
25
23
  # By default we don't support alt text, but some subclasses do
26
24
  def self.supports_alt_text?
@@ -365,7 +365,7 @@ module Spotlight
365
365
  (json[:feature_pages] || []).each do |page|
366
366
  p = exhibit.feature_pages.find_by(slug: page[:slug])
367
367
  page[:content] = p.read_attribute(:content)
368
- (page[:translated_pages]).each do |translated_page|
368
+ page[:translated_pages].each do |translated_page|
369
369
  translated_page[:content] = p.translated_page_for(translated_page[:locale]).read_attribute(:content)
370
370
  end
371
371
  end
@@ -373,7 +373,7 @@ module Spotlight
373
373
  (json[:about_pages] || []).each do |page|
374
374
  p = exhibit.about_pages.find_by(slug: page[:slug])
375
375
  page[:content] = p.read_attribute(:content)
376
- (page[:translated_pages]).each do |translated_page|
376
+ page[:translated_pages].each do |translated_page|
377
377
  translated_page[:content] = p.translated_page_for(translated_page[:locale]).read_attribute(:content)
378
378
  end
379
379
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '5.0.0-alpha1'
4
+ VERSION = '5.0.0-alpha2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.pre.alpha1
4
+ version: 5.0.0.pre.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2025-02-13 00:00:00.000000000 Z
14
+ date: 2025-02-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob-status
@@ -865,6 +865,8 @@ files:
865
865
  - app/components/spotlight/analytics/aggregation_component.rb
866
866
  - app/components/spotlight/analytics/dashboard_component.html.erb
867
867
  - app/components/spotlight/analytics/dashboard_component.rb
868
+ - app/components/spotlight/blocks/heading_block_component.erb
869
+ - app/components/spotlight/blocks/heading_block_component.rb
868
870
  - app/components/spotlight/breadcrumbs_component.html.erb
869
871
  - app/components/spotlight/breadcrumbs_component.rb
870
872
  - app/components/spotlight/bulk_action_component.html.erb