blacklight-spotlight 5.0.0 → 5.0.1

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.
@@ -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
@@ -34,7 +34,7 @@ module Spotlight
34
34
  # rubocop:enable Metrics/MethodLength
35
35
 
36
36
  def render_curator_actions?
37
- (current_exhibit && can?(:curate, current_exhibit)) &&
37
+ current_exhibit && can?(:curate, current_exhibit) &&
38
38
  !(params[:controller] == 'spotlight/catalog' && params[:action] == 'admin')
39
39
  end
40
40
  end
@@ -57,7 +57,7 @@ module Spotlight
57
57
  end
58
58
 
59
59
  def exhibit_masthead?
60
- current_exhibit&.masthead && current_exhibit.masthead.display?
60
+ current_exhibit&.masthead&.display?
61
61
  end
62
62
 
63
63
  def set_locale
@@ -73,7 +73,7 @@ module Spotlight
73
73
  end
74
74
 
75
75
  def attach_search_breadcrumb
76
- add_breadcrumb(@search.full_title, (@group.present? ? exhibit_browse_group_path(@exhibit, @group, @search) : exhibit_browse_path(@exhibit, @search)))
76
+ add_breadcrumb(@search.full_title, @group.present? ? exhibit_browse_group_path(@exhibit, @group, @search) : exhibit_browse_path(@exhibit, @search))
77
77
  end
78
78
 
79
79
  def _prefixes
@@ -89,7 +89,7 @@ module Spotlight
89
89
  end
90
90
 
91
91
  def resource_masthead?
92
- @search&.masthead && @search.masthead.display?
92
+ @search&.masthead&.display?
93
93
  end
94
94
 
95
95
  # This is overidden for the browse controller context from where it is defined in a helper
@@ -35,7 +35,8 @@ module Spotlight
35
35
  end
36
36
 
37
37
  def create
38
- @search.assign_attributes(search_params.except((:title unless @search.new_record?)))
38
+ params_to_exclude = :title unless @search.new_record?
39
+ @search.assign_attributes(search_params.except(params_to_exclude))
39
40
  @search.query_params = query_params
40
41
 
41
42
  if @search.save
@@ -20,7 +20,8 @@ module SirTrevorRails
20
20
  private
21
21
 
22
22
  def item_values
23
- Array((item.values if item.present?))
23
+ values = item.values if item.present?
24
+ Array(values)
24
25
  end
25
26
  end
26
27
  end
@@ -16,7 +16,7 @@ module Spotlight
16
16
  end
17
17
 
18
18
  def stale?
19
- created_at < (12.hours.ago)
19
+ created_at < 12.hours.ago
20
20
  end
21
21
  end
22
22
  end
@@ -1,4 +1,4 @@
1
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: f.object.id.to_s, field: f, enabled_method: :show_in_sidebar, label_method: :name } do |_, section| %>
1
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: f.object.id.to_s, field: f, index: f.index, enabled_method: :show_in_sidebar, label_method: :name } do |_, section| %>
2
2
  <% case section when nil %>
3
3
  <div class="d-flex flex-grow-1">
4
4
  <%= f.check_box :show_in_sidebar, hide_label: true, inline: true %>
@@ -1,5 +1,5 @@
1
1
  <% page = f.object %>
2
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: page.id.to_s, field: f, label: page.title, label_method: :title, enabled_method: :published } do |_, section| %>
2
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: page.id.to_s, index: f.index, field: f, label: page.title, label_method: :title, enabled_method: :published } do |_, section| %>
3
3
  <% case section when :additional_options %>
4
4
  <%= render Spotlight::EditViewLinksComponent.new(page:, delete_link: true) %>
5
5
  <%- if page.feature_page? -%>
@@ -6,7 +6,7 @@
6
6
  <% metadata = @field_metadata.field(key) %>
7
7
  <% next unless metadata[:document_count] > 0 || config.custom_field %>
8
8
  <%= idxf.fields_for key, config do |facet| %>
9
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: key, field: facet, dd3_content_classes: "facet-config-#{key.parameterize} page" , enabled_method: :show, label_method: :label, label: facet_field_label(key) } do |_, section| %>
9
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: key, field: facet, index: facet.index, dd3_content_classes: "facet-config-#{key.parameterize} page" , enabled_method: :show, label_method: :label, label: facet_field_label(key) } do |_, section| %>
10
10
  <% case section when :additional_content %>
11
11
  <div class="mt-2">
12
12
  <%= facet.form_group :terms, label_col: 'col-md-2 offset-md-1', label: { text: t(:'spotlight.search_configurations.facets.sort_by.label') } do %>
@@ -1,5 +1,5 @@
1
1
  <% group = f.object %>
2
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: group.id.to_s, field: f, dd3_content_classes: "group" , enabled_method: :published, label_method: :title, label: group.title } do |_, section| %>
2
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: group.id.to_s, index: f.index, field: f, dd3_content_classes: "group" , enabled_method: :published, label_method: :title, label: group.title } do |_, section| %>
3
3
  <% case section when nil %>
4
4
  <div class="d-flex flex-grow-1">
5
5
  <div>
@@ -1,5 +1,5 @@
1
1
  <% search = f.object %>
2
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: search.id.to_s, field: f, dd3_content_classes: "search" , enabled_method: :published, label_method: :title, label: search.title } do |_, section| %>
2
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: search.id.to_s, field: f, index: f.index, dd3_content_classes: "search" , enabled_method: :published, label_method: :title, label: search.title } do |_, section| %>
3
3
  <% case section when nil %>
4
4
  <div class="d-flex flex-grow-1">
5
5
  <div>
@@ -1,6 +1,6 @@
1
1
  <% tag = f.object %>
2
2
 
3
- <%= render layout: 'spotlight/shared/dd3_item', locals: { id: tag.id.to_s, field: f, dd3_content_classes: "tag" , enabled_method: :present?, label_method: :name, label: tag.name } do |_, section| %>
3
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: tag.id.to_s, field: f, index: f.index, dd3_content_classes: "tag" , enabled_method: :present?, label_method: :name, label: tag.name } do |_, section| %>
4
4
  <% case section when nil %>
5
5
  <div class="d-flex flex-grow-1">
6
6
  <div class="flex-grow-1 mx-2 main">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '5.0.0'
4
+ VERSION = '5.0.1'
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
4
+ version: 5.0.1
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-03-24 00:00:00.000000000 Z
14
+ date: 2025-04-24 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
@@ -1546,7 +1548,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1546
1548
  - !ruby/object:Gem::Version
1547
1549
  version: '0'
1548
1550
  requirements: []
1549
- rubygems_version: 3.5.9
1551
+ rubygems_version: 3.5.11
1550
1552
  signing_key:
1551
1553
  specification_version: 4
1552
1554
  summary: Enable librarians, curators, and others who are responsible for digital collections