blacklight-spotlight 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 470ee8ce65eb987c54dedfe26ea4db9904c9f883df098df123adf369a40636cf
4
- data.tar.gz: fd573fd059d88bd4a35dc7d253a0f01b0c593c5c3f6901fb1c6c50fe6d4e5b28
3
+ metadata.gz: 56b89965ba03cecc57a91706bab8ab9d93033988608116063650459bebd4182c
4
+ data.tar.gz: 9600146cf5c35a2d763c144d936ffd7e5bfc27a0f519e356dfba500696cbb8f1
5
5
  SHA512:
6
- metadata.gz: c8892e30dbb4d6a7ccd1ead2a40e6d78f393bd43750bee2b5b87189976d0111b30ac649e5f30312051e7b94e6deac4b870244e8979a5d2c041a61c4739580538
7
- data.tar.gz: 5da0981d722fd045dbafc9424344eed90a8a88aeae3fdc1ef2579f8828bd41c35957ae2aa80bc980c52852d221bd9ed9948d1ba7d4f41333c0892cc1ddc5aff7
6
+ metadata.gz: 40df9ad1c5506195ee5601834532b10e0551e362ad546e6594e88e1f4f00bd59b23b58b788b2c0541de8f907d1cfee87ef5d37131a75a208fa0e903817061a2b
7
+ data.tar.gz: 8cb8bc71aa03bd906b2bdea4c51b0783d5c7be866ce0dd6ac25ac34f54c65ae106f271bd84762061c10adb795082c5cc0f358d51fcff24b947e1060b7704707d
@@ -3,9 +3,6 @@
3
3
  module Spotlight
4
4
  ##
5
5
  # Base CRUD controller for pages
6
- # rubocop:disable Metrics/ClassLength
7
- # Disableing class length because this is a base
8
- # controller that gives other controllers their behavior
9
6
  class PagesController < Spotlight::ApplicationController
10
7
  before_action :authenticate_user!, except: [:show]
11
8
  before_action :load_locale_specific_page, only: %i[destroy edit show update]
@@ -32,7 +29,7 @@ module Spotlight
32
29
 
33
30
  respond_to do |format|
34
31
  format.html
35
- format.json { render json: @pages.for_locale.published.to_json(methods: [:thumbnail_image_url]) }
32
+ format.json { render json: @pages.for_default_locale.published.to_json(methods: [:thumbnail_image_url]) }
36
33
  end
37
34
  end
38
35
 
@@ -208,5 +205,4 @@ module Spotlight
208
205
  end
209
206
  end
210
207
  end
211
- # rubocop:enable Metrics/ClassLength
212
208
  end
@@ -4,7 +4,7 @@ module Spotlight
4
4
  # HTML <meta> tag helpers
5
5
  module JobTrackersHelper
6
6
  def job_status_icon(job_tracker)
7
- content_tag :span, title: t(job_tracker.status || 'missing', scope: 'spotlight.job_trackers.status') do # rubocop:disable Rails/ContentTag
7
+ content_tag :span, title: t(job_tracker.status || 'missing', scope: 'spotlight.job_trackers.status') do
8
8
  if job_tracker.enqueued? || job_tracker.in_progress?
9
9
  '⏱'
10
10
  elsif job_tracker.completed?
@@ -12,7 +12,7 @@ module SirTrevorRails
12
12
  end
13
13
 
14
14
  def pages
15
- @pages ||= parent.exhibit.pages.published.where(slug: item_ids).sort do |a, b|
15
+ @pages ||= parent.exhibit.pages.for_default_locale.published.where(slug: item_ids).sort do |a, b|
16
16
  ordered_items.index(a.slug) <=> ordered_items.index(b.slug)
17
17
  end
18
18
  end
@@ -28,7 +28,7 @@ module SirTrevorRails
28
28
 
29
29
  result[:data][:item].transform_values! do |v|
30
30
  begin
31
- v['thumbnail_image_url'] = parent.exhibit.pages.find(v['id']).thumbnail_image_url
31
+ v['thumbnail_image_url'] = parent.exhibit.pages.for_default_locale.find(v['id']).thumbnail_image_url
32
32
  rescue ActiveRecord::RecordNotFound
33
33
  v = nil
34
34
  end
@@ -46,6 +46,12 @@ module Spotlight
46
46
 
47
47
  after_update :update_translated_pages_weights_and_parent_page
48
48
 
49
+ def title
50
+ return super if I18n.locale == I18n.default_locale
51
+
52
+ translated_page_for(I18n.locale)&.title || super
53
+ end
54
+
49
55
  def content_changed!
50
56
  @content = nil
51
57
  end
@@ -133,6 +139,8 @@ module Spotlight
133
139
  end
134
140
 
135
141
  def translated_page_for(locale)
142
+ return self if locale == self.locale
143
+
136
144
  translated_pages.for_locale(locale).first
137
145
  end
138
146
 
@@ -24,7 +24,9 @@
24
24
  <body class="<%= render_body_class %>">
25
25
  <%= render partial: 'shared/body_preamble' %>
26
26
  <div id="skip-link">
27
- <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
27
+ <% if should_render_spotlight_search_bar? %>
28
+ <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
29
+ <% end %>
28
30
  <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
29
31
  <%= content_for(:skip_links) %>
30
32
  </div>
@@ -1 +1 @@
1
- <%= sanitize iframe_block.code, tags: %w(iframe), attributes: %w(id width height marginwidth marginheight src frameborder allowfullscreen sandbox seamless srcdoc scrolling) %>
1
+ <%= sanitize iframe_block.code, tags: %w(iframe), attributes: %w(id aria-label title width height marginwidth marginheight src frameborder allowfullscreen sandbox seamless srcdoc scrolling) %>
@@ -50,7 +50,7 @@ en:
50
50
  destroy: Delete group
51
51
  spotlight/role:
52
52
  create: Add a new user
53
- destroy: Remove from site
53
+ destroy: Remove from exhibit
54
54
  spotlight/search:
55
55
  destroy: Delete
56
56
  edit_long: Edit this saved search
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.1.0'
4
+ VERSION = '3.2.0'
5
5
  end
@@ -21,7 +21,10 @@ namespace :spotlight do
21
21
  print 'Exhibit title: '
22
22
  title = $stdin.gets.chomp
23
23
 
24
- exhibit = Spotlight::Exhibit.create!(title: title)
24
+ print 'Exhibit URL slug: '
25
+ slug = @stdin.gets.chomp
26
+
27
+ exhibit = Spotlight::Exhibit.create!({ title: title, slug: slug })
25
28
 
26
29
  puts 'Who can admin this exhibit?'
27
30