blacklight-spotlight 3.0.0.alpha.9 → 3.0.0.alpha.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +55 -1
- data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -2
- data/app/assets/javascripts/spotlight/admin/crop.es6 +5 -0
- data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +3 -2
- data/app/assets/stylesheets/spotlight/_accessibility.scss +1 -1
- data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
- data/app/assets/stylesheets/spotlight/_curation.scss +6 -0
- data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +3 -0
- data/app/assets/stylesheets/spotlight/_header.scss +1 -1
- data/app/assets/stylesheets/spotlight/_translations.scss +1 -0
- data/app/controllers/spotlight/appearances_controller.rb +1 -0
- data/app/controllers/spotlight/browse_controller.rb +1 -1
- data/app/controllers/spotlight/exhibits_controller.rb +2 -3
- data/app/controllers/spotlight/featured_images_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +1 -1
- data/app/controllers/spotlight/searches_controller.rb +3 -2
- data/app/controllers/spotlight/translations_controller.rb +46 -0
- data/app/helpers/spotlight/crop_helper.rb +4 -1
- data/app/models/concerns/spotlight/translatables.rb +17 -1
- data/app/models/spotlight/about_page.rb +3 -1
- data/app/models/spotlight/exhibit.rb +4 -2
- data/app/models/spotlight/feature_page.rb +3 -1
- data/app/models/spotlight/featured_image.rb +29 -12
- data/app/models/spotlight/home_page.rb +3 -1
- data/app/models/spotlight/main_navigation.rb +2 -2
- data/app/models/spotlight/masthead.rb +1 -1
- data/app/models/spotlight/page.rb +5 -1
- data/app/models/spotlight/search.rb +5 -1
- data/app/models/spotlight/solr_document_sidecar.rb +7 -5
- data/app/models/spotlight/temporary_image.rb +8 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +454 -0
- data/app/views/catalog/_save_search.html.erb +1 -1
- data/app/views/spotlight/browse/_search.html.erb +3 -2
- data/app/views/spotlight/browse/_search_title.html.erb +2 -1
- data/app/views/spotlight/pages/_form.html.erb +1 -1
- data/app/views/spotlight/searches/_form.html.erb +1 -0
- data/app/views/spotlight/searches/_search.html.erb +1 -0
- data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
- data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
- data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
- data/app/views/spotlight/translations/_general.html.erb +7 -7
- data/app/views/spotlight/translations/_import.html.erb +24 -0
- data/app/views/spotlight/translations/_metadata.html.erb +1 -1
- data/app/views/spotlight/translations/_page.html.erb +5 -5
- data/app/views/spotlight/translations/_pages.html.erb +4 -4
- data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
- data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
- data/app/views/spotlight/translations/edit.html.erb +8 -6
- data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
- data/config/locales/spotlight.ar.yml +43 -24
- data/config/locales/spotlight.en.yml +65 -53
- data/config/routes.rb +6 -1
- data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
- data/lib/spotlight/engine.rb +20 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/controllers/spotlight/home_pages_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
- data/spec/factories/featured_images.rb +4 -0
- data/spec/features/exhibits/translation_editing_spec.rb +2 -2
- data/spec/features/home_page_spec.rb +9 -0
- data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
- data/spec/i18n_spec.rb +0 -2
- data/spec/models/spotlight/exhibit_spec.rb +9 -1
- data/spec/models/spotlight/featured_image_spec.rb +28 -0
- data/spec/models/spotlight/page_spec.rb +6 -1
- data/spec/models/spotlight/resources/upload_spec.rb +43 -79
- data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +108 -22
- data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
- metadata +14 -11
- data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
- data/app/serializers/spotlight/featured_image_representer.rb +0 -29
- data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
- data/app/serializers/spotlight/page_representer.rb +0 -33
@@ -1,40 +1,59 @@
|
|
1
|
+
---
|
1
2
|
ar:
|
2
|
-
activemodel:
|
3
|
-
attributes:
|
4
|
-
spotlight/contact_form:
|
5
|
-
email: البريد الإلكتروني
|
6
|
-
message: الرسالة
|
7
|
-
name: الاسم
|
8
3
|
helpers:
|
9
4
|
action:
|
10
5
|
cancel: إلغاء
|
11
6
|
submit:
|
12
7
|
contact_form:
|
13
|
-
create:
|
14
|
-
created:
|
8
|
+
create: ارسل
|
9
|
+
created: شكراً. لقد تم إرسال ملاحظاتك واقتراحاتك.
|
15
10
|
spotlight:
|
16
11
|
about_pages:
|
17
12
|
contacts:
|
18
|
-
header:
|
19
|
-
|
20
|
-
|
21
|
-
shared:
|
22
|
-
report_a_problem:
|
23
|
-
honeypot_field_explanation: .تجاهل هذا المربع النصي، فهو يُستخدم فقط لكشف المحتالين. إذا كتبت أي شيء في هذا المربع النصي، فلن يتم إرسال رسالتك
|
24
|
-
title: عنوان
|
13
|
+
header: جهات الاتصال
|
14
|
+
breadcrumb:
|
15
|
+
label: مسار التنقل
|
25
16
|
browse:
|
26
17
|
search:
|
27
18
|
item_count:
|
28
|
-
one:
|
29
|
-
|
19
|
+
one: 1 عنصر
|
20
|
+
few: "%{count} عناصر"
|
21
|
+
many: "%{count} عناصر"
|
22
|
+
other: "%{count} عناصر"
|
23
|
+
two: عنصرين
|
24
|
+
zero: لا يوجد
|
30
25
|
search_box:
|
31
|
-
label:
|
32
|
-
placeholder:
|
26
|
+
label: ابحث في فئة التصفح الحالية
|
27
|
+
placeholder: بحث...
|
33
28
|
reset: مسح استعلام البحث
|
34
|
-
submit:
|
29
|
+
submit: ابحث في فئة التصفح
|
35
30
|
success:
|
36
|
-
expand_html: يمكنك <a href="%{expand_search_url}">البحث في كل مواد المعرض عن "%{browse_query}"</a>.
|
37
|
-
result_number_html: طابق استعلام البحث <strong> %{search_size} من %{parent_search_count}
|
31
|
+
expand_html: يمكنك ايضاً <a href="%{expand_search_url}">البحث في كل مواد المعرض عن "%{browse_query}"</a>.
|
32
|
+
result_number_html: طابق استعلام البحث <strong> %{search_size} من %{parent_search_count} عنصر</strong> في هذه الفئة.
|
38
33
|
zero_results:
|
39
|
-
expand_html: <a href="%{clear_search_url}">
|
40
|
-
result_number:
|
34
|
+
expand_html: تستطيع أن <a href="%{clear_search_url}"> تمسح استعلام البحث </a> أو محاولة <a href="%{expand_search_url}"> البحث في كل المواد المعروضة لاستعلام البحث ل"%{browse_query}"</a>
|
35
|
+
result_number: لم يتطابق بحثك مع أي عنصر في هذه الفئة.
|
36
|
+
header_links:
|
37
|
+
contact: ملاحظات واقتراحات
|
38
|
+
shared:
|
39
|
+
report_a_problem:
|
40
|
+
honeypot_field_explanation: تجاهل هذا المربع النصي، فهو يُستخدم فقط لكشف المحتالين. إذا كتبت أي شيء في هذا المربع النصي، فلن يتم إرسال رسالتك.
|
41
|
+
title: تواصل معنا
|
42
|
+
sir_trevor:
|
43
|
+
blocks:
|
44
|
+
browse_block:
|
45
|
+
items:
|
46
|
+
one: 1 عنصر
|
47
|
+
few: "%{count} عناصر"
|
48
|
+
many: "%{count} عناصر"
|
49
|
+
other: "%{count} عناصر"
|
50
|
+
two: عنصرين
|
51
|
+
zero: لا يوجد
|
52
|
+
link_to_search_block:
|
53
|
+
items:
|
54
|
+
one: 1 عنصر
|
55
|
+
few: "%{count} عناصر"
|
56
|
+
many: "%{count} عناصر"
|
57
|
+
other: "%{count} عناصر"
|
58
|
+
two: عنصرين
|
59
|
+
zero: لا يوجد
|
@@ -433,59 +433,6 @@ en:
|
|
433
433
|
label: Title
|
434
434
|
tags:
|
435
435
|
all: All
|
436
|
-
translations:
|
437
|
-
browse_categories:
|
438
|
-
default_language_column_label: English language title
|
439
|
-
description_label: Description
|
440
|
-
label: Browse categories
|
441
|
-
translation_column_label: "%{language} translation"
|
442
|
-
general:
|
443
|
-
basic_settings:
|
444
|
-
description: Description
|
445
|
-
label: Basic Settings
|
446
|
-
subtitle: Subtitle
|
447
|
-
title: Title
|
448
|
-
label: General
|
449
|
-
main_menu:
|
450
|
-
about: About
|
451
|
-
browse: Browse
|
452
|
-
curated_features: Curated Features
|
453
|
-
home: Home
|
454
|
-
label: Main Menu
|
455
|
-
metadata:
|
456
|
-
exhibit_specific_fields:
|
457
|
-
label: Exhibit-Specific Fields
|
458
|
-
label: Metadata field labels
|
459
|
-
pages:
|
460
|
-
about_pages:
|
461
|
-
label: About Pages
|
462
|
-
destroy: Delete
|
463
|
-
destroy_are_you_sure: Are you sure you want to delete this page? If you delete this page all content, including any existing translations you have made in it, will be lost.
|
464
|
-
edit: Edit
|
465
|
-
feature_pages:
|
466
|
-
label: Feature Pages
|
467
|
-
help_html: Before exhibit visitors can view translated pages you must create, edit, and publish each page translation. When you create a translated page, a copy of the default language version of the page is made to serve as the initial translated page. You can then edit that translated page to replace the page title and any text fields with translated text. A translated page will not be visible to exhibit visitors until you publish it. To replace a translated page with a current copy of the default language version of the page, use the <i>Recreate</i> action.
|
468
|
-
home_page:
|
469
|
-
label: Home Page
|
470
|
-
label: Pages
|
471
|
-
new: Create one now.
|
472
|
-
no_translated_page: No translated page.
|
473
|
-
recreate: Recreate
|
474
|
-
recreate_are_you_sure: Are you sure you want to recreate this page? If you recreate this page all content, including any existing translations you have made, will be replaced with the content of the English version of the page.
|
475
|
-
table_header:
|
476
|
-
actions: Actions
|
477
|
-
default_published: Published
|
478
|
-
language_published: Published
|
479
|
-
last_updated: "%{language} title / Last update"
|
480
|
-
search_fields:
|
481
|
-
facet_fields:
|
482
|
-
label: Facet Fields
|
483
|
-
field_based_search_fields:
|
484
|
-
label: Field-Based Search Fields
|
485
|
-
label: Search field labels
|
486
|
-
sort_fields:
|
487
|
-
label: Sort Fields
|
488
|
-
title: Translations
|
489
436
|
exhibits_admin_invitation_mailer:
|
490
437
|
invitation_instructions:
|
491
438
|
accept: Accept invitation
|
@@ -808,6 +755,71 @@ en:
|
|
808
755
|
count: Items tagged
|
809
756
|
topbar:
|
810
757
|
label: Utilities
|
758
|
+
translations:
|
759
|
+
browse_categories:
|
760
|
+
default_language_column_label: English language title
|
761
|
+
description_label: Description
|
762
|
+
label: Browse categories
|
763
|
+
subtitle_label: Subtitle
|
764
|
+
translation_column_label: "%{language} translation"
|
765
|
+
edit:
|
766
|
+
title: Translations
|
767
|
+
general:
|
768
|
+
basic_settings:
|
769
|
+
description: Description
|
770
|
+
label: Basic Settings
|
771
|
+
subtitle: Subtitle
|
772
|
+
title: Title
|
773
|
+
label: General
|
774
|
+
main_menu:
|
775
|
+
about: About
|
776
|
+
browse: Browse
|
777
|
+
curated_features: Curated Features
|
778
|
+
home: Home
|
779
|
+
label: Main Menu
|
780
|
+
import:
|
781
|
+
description: You can import and export Rails-based YAML files containing the translated label values for the currently selected language for use in internationalization tools such as Transifex and i18n-tools. This feature does not include importing or exporting translations for Pages.
|
782
|
+
export_current_locale: Export %{language}
|
783
|
+
export_default_locale: Export %{language}
|
784
|
+
export_label: Export a YAML file
|
785
|
+
header: Import and export translations
|
786
|
+
import_label: Import a YAML file
|
787
|
+
import_submit: Import translations
|
788
|
+
metadata:
|
789
|
+
exhibit_specific_fields:
|
790
|
+
label: Exhibit-Specific Fields
|
791
|
+
label: Metadata field labels
|
792
|
+
page:
|
793
|
+
destroy: Delete
|
794
|
+
destroy_are_you_sure: Are you sure you want to delete this page? If you delete this page all content, including any existing translations you have made in it, will be lost.
|
795
|
+
edit: Edit
|
796
|
+
new: Create one now.
|
797
|
+
no_translated_page: No translated page.
|
798
|
+
recreate: Recreate
|
799
|
+
recreate_are_you_sure: Are you sure you want to recreate this page? If you recreate this page all content, including any existing translations you have made, will be replaced with the content of the English version of the page.
|
800
|
+
pages:
|
801
|
+
about_pages:
|
802
|
+
label: About Pages
|
803
|
+
feature_pages:
|
804
|
+
label: Feature Pages
|
805
|
+
help_html: Before exhibit visitors can view translated pages you must create, edit, and publish each page translation. When you create a translated page, a copy of the default language version of the page is made to serve as the initial translated page. You can then edit that translated page to replace the page title and any text fields with translated text. A translated page will not be visible to exhibit visitors until you publish it. To replace a translated page with a current copy of the default language version of the page, use the <i>Recreate</i> action.
|
806
|
+
home_page:
|
807
|
+
label: Home Page
|
808
|
+
label: Pages
|
809
|
+
pages_table:
|
810
|
+
header:
|
811
|
+
actions: Actions
|
812
|
+
default_published: Published
|
813
|
+
language_published: Published
|
814
|
+
last_updated: "%{language} title / Last update"
|
815
|
+
search_fields:
|
816
|
+
facet_fields:
|
817
|
+
label: Facet Fields
|
818
|
+
field_based_search_fields:
|
819
|
+
label: Field-Based Search Fields
|
820
|
+
label: Search field labels
|
821
|
+
sort_fields:
|
822
|
+
label: Sort Fields
|
811
823
|
versions:
|
812
824
|
redo: Redo changes
|
813
825
|
undo: Undo changes
|
data/config/routes.rb
CHANGED
@@ -143,7 +143,12 @@ Spotlight::Engine.routes.draw do
|
|
143
143
|
end
|
144
144
|
end
|
145
145
|
post 'solr/update' => 'solr#update'
|
146
|
-
resource :translations, only: %i[edit update]
|
146
|
+
resource :translations, only: %i[edit update show] do
|
147
|
+
collection do
|
148
|
+
post 'import'
|
149
|
+
patch 'import'
|
150
|
+
end
|
151
|
+
end
|
147
152
|
end
|
148
153
|
|
149
154
|
get '/:exhibit_id' => 'home_pages#show', as: :exhibit_root
|
data/lib/spotlight/engine.rb
CHANGED
@@ -160,6 +160,7 @@ module Spotlight
|
|
160
160
|
|
161
161
|
# Configure the CarrierWave file storage mechanism
|
162
162
|
config.uploader_storage = :file
|
163
|
+
config.featured_image_masthead_size = [1800, 180]
|
163
164
|
config.featured_image_thumb_size = [400, 300]
|
164
165
|
config.featured_image_square_size = [400, 400]
|
165
166
|
config.contact_square_size = [70, 70]
|
@@ -214,6 +215,25 @@ module Spotlight
|
|
214
215
|
# add could add an available locale which could break things if unexpected.
|
215
216
|
config.i18n.available_locales = config.i18n_locales.keys
|
216
217
|
|
218
|
+
# Copy of JbuilderHandler tweaked to spit out YAML for translation exports
|
219
|
+
class TranslationYamlHandler
|
220
|
+
cattr_accessor :default_format
|
221
|
+
self.default_format = :yaml
|
222
|
+
|
223
|
+
def self.call(template, source = nil)
|
224
|
+
source ||= template.source
|
225
|
+
# this juggling is required to keep line numbers right in the error
|
226
|
+
%{__already_defined = defined?(json); json||=JbuilderTemplate.new(self); #{source}
|
227
|
+
json.attributes!.to_yaml unless (__already_defined && __already_defined != "method")}
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
initializer :yamlbuilder do
|
232
|
+
ActiveSupport.on_load :action_view do
|
233
|
+
ActionView::Template.register_template_handler :yamlbuilder, TranslationYamlHandler
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
217
237
|
# Query parameters for autocomplete requests
|
218
238
|
config.autocomplete_search_field = 'autocomplete'
|
219
239
|
config.default_autocomplete_params = { qf: 'id^1000 full_title_tesim^100 id_ng full_title_ng',
|
data/lib/spotlight/version.rb
CHANGED
@@ -41,7 +41,7 @@ describe Spotlight::HomePagesController, type: :controller, versioning: true do
|
|
41
41
|
it 'redirects to the feature page index action' do
|
42
42
|
put :update, params: { id: page, exhibit_id: page.exhibit.id, home_page: valid_attributes }
|
43
43
|
page.reload
|
44
|
-
expect(response).to redirect_to(exhibit_home_page_path(page.exhibit
|
44
|
+
expect(response).to redirect_to(exhibit_home_page_path(page.exhibit))
|
45
45
|
expect(flash[:notice]).to have_link 'Undo changes'
|
46
46
|
end
|
47
47
|
end
|
@@ -2,10 +2,9 @@
|
|
2
2
|
|
3
3
|
describe Spotlight::TranslationsController do
|
4
4
|
routes { Spotlight::Engine.routes }
|
5
|
+
let(:exhibit) { FactoryBot.create(:exhibit) }
|
5
6
|
|
6
7
|
describe '#edit' do
|
7
|
-
let(:exhibit) { FactoryBot.create(:exhibit) }
|
8
|
-
|
9
8
|
context 'when not signed in' do
|
10
9
|
it 'is not successful' do
|
11
10
|
get :edit, params: { exhibit_id: exhibit }
|
@@ -78,4 +77,56 @@ describe Spotlight::TranslationsController do
|
|
78
77
|
end
|
79
78
|
end
|
80
79
|
end
|
80
|
+
|
81
|
+
describe '#show' do
|
82
|
+
render_views
|
83
|
+
before do
|
84
|
+
sign_in user
|
85
|
+
FactoryBot.create(:translation, exhibit: exhibit, locale: 'es', key: "#{exhibit.slug}.title", value: 'Titulo')
|
86
|
+
end
|
87
|
+
|
88
|
+
let(:user) { FactoryBot.create(:site_admin) }
|
89
|
+
|
90
|
+
it 'provides a YML dump of the default language translations' do
|
91
|
+
get :show, params: { exhibit_id: exhibit, format: 'yaml' }
|
92
|
+
expect(response).to be_successful
|
93
|
+
translations = YAML.safe_load(response.body).with_indifferent_access
|
94
|
+
|
95
|
+
expect(translations).to include :en
|
96
|
+
expect(translations[:en]).to include :blacklight, :spotlight, exhibit.slug
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'provides a YML dump of the requested language translations' do
|
100
|
+
get :show, params: { exhibit_id: exhibit, format: 'yaml', locale: 'es' }
|
101
|
+
expect(response).to be_successful
|
102
|
+
translations = YAML.safe_load(response.body).with_indifferent_access
|
103
|
+
|
104
|
+
expect(translations).to include :es
|
105
|
+
expect(translations[:es]).to include :blacklight, :spotlight, exhibit.slug
|
106
|
+
expect(translations[:es][exhibit.slug]).to include title: 'Titulo', subtitle: nil
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe '#import' do
|
111
|
+
before { sign_in user }
|
112
|
+
|
113
|
+
let(:user) { FactoryBot.create(:site_admin) }
|
114
|
+
|
115
|
+
it 'is successful' do
|
116
|
+
f = Tempfile.new('foo')
|
117
|
+
begin
|
118
|
+
f.write({ en: { exhibit.slug => { title: 'Imported title' } } }.deep_stringify_keys.to_yaml)
|
119
|
+
f.rewind
|
120
|
+
file = Rack::Test::UploadedFile.new(f.path, 'text/plain')
|
121
|
+
patch :import, params: { exhibit_id: exhibit, file: file }
|
122
|
+
ensure
|
123
|
+
f.close
|
124
|
+
f.unlink
|
125
|
+
end
|
126
|
+
expect(response).to be_redirect
|
127
|
+
assigns[:exhibit].tap do |saved|
|
128
|
+
expect(saved.title).to eq 'Imported title'
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
81
132
|
end
|
@@ -6,6 +6,10 @@ FactoryBot.define do
|
|
6
6
|
iiif_tilesource { 'https://exhibits-stage.stanford.edu/images/78' }
|
7
7
|
end
|
8
8
|
|
9
|
+
factory :temporary_image, class: 'Spotlight::TemporaryImage' do
|
10
|
+
image { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
11
|
+
end
|
12
|
+
|
9
13
|
factory :masthead, class: 'Spotlight::Masthead' do
|
10
14
|
image { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'avatar.png'), __dir__)) }
|
11
15
|
end
|
@@ -330,7 +330,7 @@ describe 'Translation editing', type: :feature do
|
|
330
330
|
|
331
331
|
it 'has a title and description for every browse category' do
|
332
332
|
within '#browse' do
|
333
|
-
expect(page).to have_css('input[type="text"]', count:
|
333
|
+
expect(page).to have_css('input[type="text"]', count: 4)
|
334
334
|
expect(page).to have_css('textarea', count: 2)
|
335
335
|
|
336
336
|
expect(page).to have_field 'All Exhibit Items'
|
@@ -407,7 +407,7 @@ describe 'Translation editing', type: :feature do
|
|
407
407
|
visit spotlight.edit_exhibit_translations_path(exhibit, language: 'fr')
|
408
408
|
expect(page).to have_link('General 1/8')
|
409
409
|
expect(page).to have_link('Search field labels 0/16')
|
410
|
-
expect(page).to have_link('Browse categories 0/
|
410
|
+
expect(page).to have_link('Browse categories 0/3')
|
411
411
|
expect(page).to have_link('Metadata field labels 0/17')
|
412
412
|
end
|
413
413
|
end
|
@@ -31,6 +31,15 @@ describe 'Home page', type: :feature, versioning: true do
|
|
31
31
|
expect(page).to have_selector '.card-title a', text: 'New Home Page Title'
|
32
32
|
end
|
33
33
|
|
34
|
+
it 'redirects back to the correct home page URL after updating (no format param to interfere w/ faceting)' do
|
35
|
+
visit spotlight.exhibit_home_page_path(exhibit.home_page)
|
36
|
+
|
37
|
+
click_link 'Edit'
|
38
|
+
click_button 'Save changes'
|
39
|
+
|
40
|
+
expect(page.current_url).to eq spotlight.exhibit_home_page_url(exhibit)
|
41
|
+
end
|
42
|
+
|
34
43
|
it 'has working facet links' do
|
35
44
|
visit spotlight.exhibit_home_page_path(exhibit.home_page)
|
36
45
|
click_button 'Genre'
|
@@ -26,6 +26,7 @@ describe 'Uploaded Items Block', feature: true, js: true, versioning: true do
|
|
26
26
|
within('.dd-list') do
|
27
27
|
expect(page).to have_css('.card-title', text: '800x600.png')
|
28
28
|
fill_in 'Caption', with: 'Some caption text'
|
29
|
+
fill_in 'Link URL', with: 'https://example.com/'
|
29
30
|
end
|
30
31
|
|
31
32
|
attach_file('uploaded_item_url', fixture_file2)
|
@@ -41,8 +42,10 @@ describe 'Uploaded Items Block', feature: true, js: true, versioning: true do
|
|
41
42
|
expect(page).to have_css('p', text: text)
|
42
43
|
|
43
44
|
within('.uploaded-items-block') do
|
44
|
-
expect(page).to have_css('img[alt=""]', count:
|
45
|
+
expect(page).to have_css('img[alt=""]', count: 1)
|
46
|
+
expect(page).to have_css('img[alt="Some caption text"]', count: 1)
|
45
47
|
expect(page).to have_css '.caption', text: 'Some caption text'
|
48
|
+
expect(page).to have_link 'Some caption text', href: 'https://example.com/'
|
46
49
|
end
|
47
50
|
end
|
48
51
|
|
data/spec/i18n_spec.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'i18n/tasks'
|
4
4
|
|
5
|
-
# rubocop:disable RSpec/DescribeClass
|
6
5
|
RSpec.describe 'I18n' do
|
7
6
|
let(:i18n) { I18n::Tasks::BaseTask.new }
|
8
7
|
let(:missing_keys) { i18n.missing_keys }
|
@@ -26,4 +25,3 @@ RSpec.describe 'I18n' do
|
|
26
25
|
expect(non_normalized).to be_empty, error_message
|
27
26
|
end
|
28
27
|
end
|
29
|
-
# rubocop:enable RSpec/DescribeClass
|
@@ -28,7 +28,7 @@ describe Spotlight::Exhibit, type: :model do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'does not validate the presence of the title under a non-default locale' do
|
31
|
-
|
31
|
+
allow(I18n).to receive(:locale).and_return(:fr)
|
32
32
|
exhibit.title = ''
|
33
33
|
expect do
|
34
34
|
exhibit.save
|
@@ -402,6 +402,7 @@ describe Spotlight::Exhibit, type: :model do
|
|
402
402
|
I18n.locale = 'fr'
|
403
403
|
persisted_exhibit.reload
|
404
404
|
expect(persisted_exhibit.title).to eq 'Titre français'
|
405
|
+
expect(persisted_exhibit.translated_title).to eq 'Titre français'
|
405
406
|
end
|
406
407
|
|
407
408
|
it 'has a translatable subtitle' do
|
@@ -417,5 +418,12 @@ describe Spotlight::Exhibit, type: :model do
|
|
417
418
|
persisted_exhibit.reload
|
418
419
|
expect(persisted_exhibit.description).to eq 'Description français'
|
419
420
|
end
|
421
|
+
|
422
|
+
it 'is nil if no translation has been prrovided' do
|
423
|
+
expect(persisted_exhibit.title).to eq 'Sample'
|
424
|
+
I18n.locale = 'es'
|
425
|
+
persisted_exhibit.reload
|
426
|
+
expect(persisted_exhibit.translated_title(default: '')).to eq nil
|
427
|
+
end
|
420
428
|
end
|
421
429
|
end
|