blacklight 7.3.0 → 7.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/app/helpers/blacklight/blacklight_helper_behavior.rb +2 -1
  4. data/app/helpers/blacklight/catalog_helper_behavior.rb +2 -3
  5. data/app/helpers/blacklight/configuration_helper_behavior.rb +3 -2
  6. data/app/helpers/blacklight/layout_helper_behavior.rb +7 -0
  7. data/app/helpers/blacklight/render_partials_helper_behavior.rb +1 -9
  8. data/app/helpers/blacklight/url_helper_behavior.rb +2 -2
  9. data/app/presenters/blacklight/document_presenter.rb +74 -4
  10. data/app/presenters/blacklight/field_presenter.rb +22 -11
  11. data/app/presenters/blacklight/index_presenter.rb +9 -50
  12. data/app/presenters/blacklight/show_presenter.rb +6 -53
  13. data/app/presenters/blacklight/thumbnail_presenter.rb +14 -4
  14. data/app/services/blacklight/field_retriever.rb +7 -1
  15. data/app/views/catalog/_document.atom.builder +1 -1
  16. data/app/views/catalog/_document.rss.builder +2 -2
  17. data/app/views/catalog/_facet_layout.html.erb +3 -3
  18. data/app/views/catalog/_opensearch_response_metadata.html.erb +3 -3
  19. data/app/views/catalog/_search_results.html.erb +1 -1
  20. data/app/views/catalog/index.json.jbuilder +2 -3
  21. data/app/views/catalog/show.json.jbuilder +3 -3
  22. data/app/views/layouts/blacklight/base.html.erb +2 -2
  23. data/config/i18n-tasks.yml +1 -1
  24. data/config/locales/blacklight.ar.yml +250 -0
  25. data/config/locales/blacklight.hu.yml +8 -0
  26. data/config/locales/blacklight.nl.yml +8 -0
  27. data/config/locales/blacklight.sq.yml +9 -0
  28. data/config/locales/blacklight.zh.yml +8 -0
  29. data/lib/blacklight/configuration.rb +16 -4
  30. data/spec/features/search_spec.rb +5 -0
  31. data/spec/helpers/blacklight/configuration_helper_behavior_spec.rb +4 -0
  32. data/spec/helpers/blacklight/layout_helper_behavior_spec.rb +10 -0
  33. data/spec/helpers/blacklight/url_helper_behavior_spec.rb +5 -5
  34. data/spec/helpers/catalog_helper_spec.rb +9 -0
  35. data/spec/models/blacklight/configuration_spec.rb +32 -10
  36. data/spec/presenters/blacklight/document_presenter_spec.rb +9 -14
  37. data/spec/presenters/blacklight/show_presenter_spec.rb +23 -6
  38. data/spec/presenters/thumbnail_presenter_spec.rb +1 -2
  39. data/spec/views/catalog/_facet_layout.html.erb_spec.rb +3 -2
  40. data/spec/views/catalog/index.html.erb_spec.rb +1 -1
  41. metadata +3 -2
@@ -19,7 +19,9 @@ module Blacklight
19
19
  retrieve_highlight
20
20
  elsif field_config.accessor
21
21
  retieve_using_accessor
22
- elsif field_config
22
+ elsif field_config.values
23
+ retrieve_values
24
+ else
23
25
  retrieve_simple
24
26
  end
25
27
  )
@@ -55,5 +57,9 @@ module Blacklight
55
57
  # retrieve the document value from the highlighting response
56
58
  document.highlight_field(field_config.field).map(&:html_safe) if document.has_highlight_field? field_config.field
57
59
  end
60
+
61
+ def retrieve_values
62
+ field_config.values.call(field_config, document)
63
+ end
58
64
  end
59
65
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  xml.entry do
4
- xml.title index_presenter(document).label(document_show_link_field(document))
4
+ xml.title index_presenter(document).heading
5
5
 
6
6
  # updated is required, for now we'll just set it to now, sorry
7
7
  xml.updated Time.current.iso8601
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- xml.item do
4
- xml.title(index_presenter(document).label(document_show_link_field(document)) || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
3
+ xml.item do
4
+ xml.title(index_presenter(document).heading || (document.to_semantic_values[:title].first if document.to_semantic_values.key?(:title)))
5
5
  xml.link(polymorphic_url(url_for_document(document)))
6
6
  xml.author( document.to_semantic_values[:author].first ) if document.to_semantic_values.key? :author
7
7
  end
@@ -1,15 +1,15 @@
1
1
  <div class="card facet-limit blacklight-<%= facet_field.key.parameterize %> <%= 'facet-limit-active' if facet_field_in_params?(facet_field.key) %>">
2
2
  <h3 class="card-header p-0 facet-field-heading" id="<%= facet_field_id(facet_field) %>-header">
3
3
  <button
4
- class="btn btn-block p-2 text-left <%= "collapsed" if should_collapse_facet?(facet_field) %> collapse-toggle"
4
+ class="btn btn-block p-2 text-left collapse-toggle"
5
5
  data-toggle="collapse"
6
6
  data-target="#<%= facet_field_id(facet_field) %>"
7
- aria-expanded="false"
7
+ aria-expanded="<%= should_collapse_facet?(facet_field) ? 'false' : 'true' %>"
8
8
  >
9
9
  <%= facet_field_label(facet_field.key) %>
10
10
  </button>
11
11
  </h3>
12
- <div id="<%= facet_field_id(facet_field) %>" aria-labelledby="<%= facet_field_id(facet_field) %>-header" class="panel-collapse facet-content <%= should_collapse_facet?(facet_field) ? 'collapse' : 'show' %>">
12
+ <div id="<%= facet_field_id(facet_field) %>" aria-labelledby="<%= facet_field_id(facet_field) %>-header" class="panel-collapse facet-content collapse <%= "show" unless should_collapse_facet?(facet_field) %>">
13
13
  <div class="card-body">
14
14
  <%= yield %>
15
15
  </div>
@@ -1,3 +1,3 @@
1
- <%= tag :meta, :name => "totalResults", :content => @response.total %>
2
- <%= tag :meta, :name => "startIndex", :content => @response.start %>
3
- <%= tag :meta, :name => "itemsPerPage", :content => @response.limit_value %>
1
+ <%= tag :meta, name: "totalResults", content: response.total %>
2
+ <%= tag :meta, name: "startIndex", content: response.start %>
3
+ <%= tag :meta, name: "itemsPerPage", content: response.limit_value %>
@@ -1,7 +1,7 @@
1
1
  <% @page_title = t('blacklight.search.page_title.title', :constraints => render_search_to_page_title(params), :application_name => application_name) %>
2
2
 
3
3
  <% content_for(:head) do -%>
4
- <%= render_opensearch_response_metadata %>
4
+ <%= render 'catalog/opensearch_response_metadata', response: @response %>
5
5
  <%= rss_feed_link_tag %>
6
6
  <%= atom_feed_link_tag %>
7
7
  <%= json_api_link_tag %>
@@ -12,12 +12,11 @@ end
12
12
 
13
13
  json.data do
14
14
  json.array! @presenter.documents do |document|
15
+ doc_presenter = index_presenter(document)
15
16
  document_url = polymorphic_url(url_for_document(document))
16
17
  json.id document.id
17
- json.type document[blacklight_config.view_config(:index).display_type_field]
18
+ json.type doc_presenter.display_type.first
18
19
  json.attributes do
19
- doc_presenter = index_presenter(document)
20
-
21
20
  doc_presenter.fields_to_render.each do |field_name, field|
22
21
  json.partial! 'field', field: field,
23
22
  field_name: field_name,
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  document_url = polymorphic_url(@document)
4
+ doc_presenter = show_presenter(@document)
5
+
4
6
  json.links do
5
7
  json.self document_url
6
8
  end
7
9
 
8
10
  json.data do
9
11
  json.id @document.id
10
- json.type @document[blacklight_config.view_config(:show).display_type_field]
12
+ json.type doc_presenter.display_type.first
11
13
  json.attributes do
12
- doc_presenter = show_presenter(@document)
13
-
14
14
  doc_presenter.fields_to_render.each do |field_name, field|
15
15
  json.partial! 'field', field: field,
16
16
  field_name: field_name,
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en" class="no-js">
2
+ <%= content_tag :html, class: 'no-js', **html_tag_attributes do %>
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
@@ -37,4 +37,4 @@
37
37
  <%= render partial: 'shared/footer' %>
38
38
  <%= render partial: 'shared/modal' %>
39
39
  </body>
40
- </html>
40
+ <% end %>
@@ -1,6 +1,6 @@
1
1
  # i18n-tasks finds and manages missing and unused translations: https://github.com/glebm/i18n-tasks
2
2
  base_locale: en
3
- locales: [es, fr, de, it, pt-BR]
3
+ locales: [ar, de, es, fr, hu, it, nl, pt-BR, sq, zh]
4
4
  data:
5
5
  read:
6
6
  - config/locales/%{locale}.yml
@@ -0,0 +1,250 @@
1
+ ar:
2
+ views:
3
+ pagination:
4
+ first: 'الأولى ;&laquo'
5
+ last: 'الأخيرة &raquo;'
6
+ previous: '&laquo; السابقة'
7
+ next: 'التالية &raquo;'
8
+ truncate: '…'
9
+ aria:
10
+ container_label: 'روابط الصفحات'
11
+ current_page: 'الصفحة الحالية، الصفحة %{page}'
12
+ go_to_page: 'الانتقال إلى %{page}'
13
+ go_to_previous_page: 'الانتقال للصفحة السابقة'
14
+ go_to_next_page: 'الانتقال للصفحة التالية'
15
+ go_to_first_page: 'الانتقال للصفحة الأولى'
16
+ go_to_last_page: 'الانتقال للصفحة الأخيرة'
17
+
18
+ pagination_compact:
19
+ previous: '&laquo; السابقة'
20
+ next: 'التالية &raquo;'
21
+
22
+ blacklight:
23
+ application_name: 'Blacklight'
24
+ skip_links:
25
+ main_content: 'انتقل إلى المحتوى الرئيسي'
26
+ search_field: 'انتقل إلى البحث'
27
+ first_result: 'انتقل إلى النتيجة الأولى'
28
+ header_links:
29
+ login: 'تسجيل الدخول'
30
+ logout: 'تسجيل الخروج'
31
+ bookmarks: 'الصفحات المفضلة'
32
+ search_history: 'سجل البحث السابق'
33
+
34
+ welcome: 'مرحبًا!'
35
+ and: 'و'
36
+ or: 'أو'
37
+
38
+ modal:
39
+ close: "إغلاق"
40
+
41
+ bookmarks:
42
+ title: 'الصفحات المفضلة'
43
+ page_title: 'الصفحات المفضلة - %{application_name}'
44
+ no_bookmarks: 'ليس لديك صفحات مفضلة'
45
+ add:
46
+ button: 'صفحة مفضلة'
47
+ success:
48
+ zero: 'لم يتم إضافة أي صفحة مفضلة.'
49
+ one: 'أضيفت الصفحة المفضلة بنجاح.'
50
+ two: 'أضيفت صفحتان مفضلتان بنجاح.'
51
+ few: 'أضيفت الصفحات المفضلة بنجاح.'
52
+ many: 'أضيفت الصفحات المفضلة بنجاح.'
53
+ other: 'أضيفت الصفحات المفضلة بنجاح.'
54
+ failure: 'معذرة! حدثت مشكلة في حفظ الصفحات المفضلة.'
55
+ remove:
56
+ button: 'إزالة الصفحة المفضلة'
57
+ success: 'أزيلت الصفحة المفضلة بنجاح.'
58
+ failure: 'معذرة! حدثت مشكلة في إزالة الصفحات المفضلة.'
59
+ action_confirm: 'هل ترغب في إزالة الصفحة المفضلة؟'
60
+ clear:
61
+ action_title: 'مسح الصفحات المفضلة'
62
+ action_confirm: 'هل ترغب في مسح الصفحات المفضلة؟'
63
+ success: 'ُمسِحَت صفحاتك المفضلة.'
64
+ failure: 'معذرة! حدثت مشكلة في مسح صفحاتك المفضلة.'
65
+ need_login: 'يُرجى تسجيل الدخول لتنظيم صفحاتك المفضلة وعرضها.'
66
+ list_title: 'صفحاتك المفضلة'
67
+ delete: 'إزالة'
68
+
69
+ search_history:
70
+ clear:
71
+ action_title: 'مسح سجل البحث السابق'
72
+ action_confirm: 'هل ترغب في مسح سجل البحث السابق؟'
73
+ success: 'ُمسِحَ سجل بحثك السابق.'
74
+ failure: 'حدثت مشكلة في مسح سجل بحثك السابق.'
75
+ title: 'سجل البحث'
76
+ page_title: 'سجل البحث - %{application_name}'
77
+ no_history: 'ليس لديك سجل بحث'
78
+ recent: 'استعلامات البحث الأخيرة'
79
+ forget: 'تراجع'
80
+ save: 'حفظ'
81
+
82
+ tools:
83
+ title: 'أدوات'
84
+ citation: 'استشهاد مرجعي'
85
+ email: 'بريد إلكتروني'
86
+ sms: 'إرسال كرسالة نصية قصيرة'
87
+ clear: 'مسح'
88
+
89
+ citation:
90
+ mla: 'جمعية اللغة الحديثة MLA'
91
+ apa: 'الجمعية الأمريكية لعلم النفس APA'
92
+ chicago: 'شيكاغو'
93
+
94
+ email:
95
+ form:
96
+ title: 'إرسال بالبريد الإلكتروني'
97
+ to: 'بريد إلكتروني:'
98
+ message: 'الرسالة:'
99
+ submit: 'إرسال'
100
+ text:
101
+ default_title: 'لا ينطبق'
102
+ title: 'العنوان: %{value}'
103
+ author: 'المؤلف: %{value}'
104
+ format: 'الصيغة: %{value}'
105
+ language: 'اللغة: %{value}'
106
+ subject:
107
+ zero: 'لا يوجد سجل للمادة'
108
+ one: 'سجل المادة: %{title}'
109
+ two: 'سجلان للمادة'
110
+ few: 'سجلات المادة'
111
+ many: 'سجلات المادة'
112
+ other: 'سجلات المادة'
113
+ url: 'الرابط: %{url}'
114
+ message: 'الرسالة: %{message}'
115
+
116
+ success: 'تم إرسال البريد الإلكتروني'
117
+ errors:
118
+ to:
119
+ invalid: 'يجب إدخال عنوان بريد إلكتروني صحيح'
120
+ blank: 'يجب إدخال مُستلم من أجل إرسال هذه الرسالة'
121
+
122
+ sms:
123
+ form:
124
+ title: 'إرسال كرسالة نصية قصيرة'
125
+ to: 'رقم الهاتف:'
126
+ carrier: 'شركة الاتصالات'
127
+ carrier_prompt: 'يرجى تحديد شركة الاتصالات'
128
+ submit: 'إرسال'
129
+ text:
130
+ title: '%{value}'
131
+ author: ' حسب %{value}'
132
+ url: 'الرابط: %{url}'
133
+ success: 'تم الإرسال كرسالة نصية قصيرة'
134
+ errors:
135
+ to:
136
+ invalid: 'يجب إدخال رقم هاتف صحيح من 10 أعداد'
137
+ blank: "يجب إدخال رقم هاتف المستلم لإرسال هذه الرسالة"
138
+ carrier:
139
+ blank: 'يجب تحديد شركة الاتصالات'
140
+ invalid: "يجب إدخال شركة اتصالات صحيحة"
141
+
142
+ back_to_search: 'عودة لصفحة البحث'
143
+ back_to_bookmarks: 'عودة لصفحة الصفحات المفضلة'
144
+
145
+ search:
146
+ page_title:
147
+ title: '%{constraints} - %{application_name} نتائج البحث'
148
+ constraint: '%{label}: %{value}'
149
+ many_constraint_values: 'تم تحديد %{values}'
150
+ header: 'البحث'
151
+ search_constraints_header: 'قيود البحث'
152
+ search_results: 'نتائج البحث'
153
+ errors:
154
+ request_error: "معذرة، لا أفهم ما تبحث عنه."
155
+ invalid_solr_id: "معذرة! لقد طلبت سجلًا غير موجود."
156
+ per_page:
157
+ label: '%{count}<span class="sr-only"> لكل صفحة</span>'
158
+ button_label: '%{count} لكل صفحة' # TODO: Remove during major release
159
+ button_label_html: '%{count}<span class="d-none d-sm-inline"> لكل صفحة</span>'
160
+ title: 'عدد النتائج المعروضة في الصفحة'
161
+ submit: 'تحديث'
162
+ sort:
163
+ label: 'ترتيب حسب %{field}' # TODO: Remove during major release
164
+ label_html: 'ترتيب <span class="d-none d-sm-inline"> حسب %{field}</span>'
165
+ submit: 'نتائج الترتيب'
166
+ form:
167
+ search_field:
168
+ label: 'بحث في'
169
+ title: 'خيارات البحث المستهدفة'
170
+ post_label: 'عن'
171
+ search:
172
+ label: 'بحث عن'
173
+ placeholder: 'بحث...'
174
+ submit: 'بحث'
175
+ pagination:
176
+ title: 'تصفح النتائج'
177
+ pagination_info:
178
+ no_items_found: 'لم يتم العثور على %{entry_name}'
179
+ single_item_found: 'تم العثور على <strong>1</strong> %{entry_name}'
180
+ pages:
181
+ zero: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
182
+ one: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
183
+ two: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
184
+ few: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
185
+ many: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
186
+ other: '<strong>%{start_num}</strong> - <strong>%{end_num}</strong> من <strong>%{total_num}</strong>'
187
+ entry_pagination_info:
188
+ zero: '<strong>%{current}</strong> من <strong>%{total}</strong>'
189
+ one: '<strong>%{current}</strong> من <strong>%{total}</strong>'
190
+ two: '<strong>%{current}</strong> من <strong>%{total}</strong>'
191
+ few: '<strong>%{current}</strong> من <strong>%{total}</strong>'
192
+ many: '<strong>%{current}</strong> من <strong>%{total}</strong>'
193
+ other: '<strong>%{current}</strong> من <strong>%{total}</strong>'
194
+ documents:
195
+ aria:
196
+ search_results: 'نتائج البحث'
197
+ limit_search: 'تحديد نطاق البحث'
198
+ counter: '%{counter}. '
199
+ facets:
200
+ title: 'تحديد نطاق البحث'
201
+ clear: 'إزالة معايير البحث'
202
+ sort:
203
+ count: 'ترتيب رقمي'
204
+ index: 'ترتيب أبجدي'
205
+ count: '%{number}'
206
+ more_html: 'المزيد <span class="sr-only">%{field_name}</span> »'
207
+ selected:
208
+ remove: '[إزالة]'
209
+ missing: "[غير موجود]"
210
+ all: الكل
211
+ group:
212
+ more: 'المزيد »'
213
+ filters:
214
+ title: 'لقد بحثت عن:'
215
+ label: '%{label}:'
216
+ remove:
217
+ value: 'إزالة القيد %{value}'
218
+ label_value: 'إزالة القيد %{label}: %{value}'
219
+ start_over: 'البدء من جديد'
220
+ index:
221
+ label: '%{label}:'
222
+ show:
223
+ title: '%{document_title} - %{application_name}'
224
+ label: '%{label}:'
225
+ rss_feed: 'خلاصات RSS للنتائج'
226
+ atom_feed: 'خلاصات Atom للنتائج'
227
+ bookmarks:
228
+ present: "في الصفحات المفضلة"
229
+ absent: "صفحة مفضلة"
230
+ inprogress: "حفظ..."
231
+ zero_results:
232
+ title: "لا توجد نتائج للبحث"
233
+ modify_search: "حاول تعديل معايير البحث"
234
+ use_fewer_keywords: "استخدم كلمات مفتاحية أقل في البداية، ثم أعد تنقيح البحث باستخدام الروابط على اليسار."
235
+ search_fields: "لقد بحثت باستخدام %{search_fields}"
236
+ search_everything: "أعد البحث عن كل شيء"
237
+ view_title: "عرض النتائج ك: "
238
+ view:
239
+ list: "قائمة"
240
+
241
+ entry_name:
242
+ default: 'إدخال'
243
+ grouped:
244
+ default: 'النتائج المجمعة'
245
+
246
+ did_you_mean: 'هل كنت تقصد كتابة: %{options}؟'
247
+
248
+ main:
249
+ aria:
250
+ main_container: 'المحتوى الرئيسي'
@@ -6,6 +6,14 @@ hu:
6
6
  previous: '&laquo; Előző'
7
7
  next: 'Következő &raquo;'
8
8
  truncate: '…'
9
+ aria:
10
+ container_label: pagination linkek
11
+ current_page: Aktuális oldal, %{page} oldal
12
+ go_to_page: Ugrás a %{page} oldalra
13
+ go_to_previous_page: Ugrás az előző oldalra
14
+ go_to_next_page: Ugrás a következő oldalra
15
+ go_to_first_page: Ugrás az első oldalra
16
+ go_to_last_page: Ugrás az utolsó oldalra
9
17
 
10
18
  pagination_compact:
11
19
  previous: '&laquo; Előző'
@@ -6,6 +6,14 @@ nl:
6
6
  previous: '&laquo; Vorige'
7
7
  next: 'Volgende &raquo;'
8
8
  truncate: '…'
9
+ aria:
10
+ container_label: paginatielinks
11
+ current_page: Huidige pagina, Pagina %{page}
12
+ go_to_page: Ga naar pagina %{page}
13
+ go_to_previous_page: Ga naar de vorige pagina
14
+ go_to_next_page: Ga naar de volgende pagina
15
+ go_to_first_page: Ga naar de eerste pagina
16
+ go_to_last_page: Ga naar de laatste pagina
9
17
 
10
18
  pagination_compact:
11
19
  previous: '&laquo; Vorige'
@@ -6,12 +6,21 @@ sq:
6
6
  previous: '&laquo; Mbrapa'
7
7
  next: 'Tjetra &raquo;'
8
8
  truncate: '…'
9
+ aria:
10
+ container_label: lidhjet e pagination
11
+ current_page: Faqja aktuale, Faqja %{page}
12
+ go_to_page: Shkoni te faqja %{page}
13
+ go_to_previous_page: Shko te faqja e mëparshme
14
+ go_to_next_page: Shko te faqja tjetër
15
+ go_to_first_page: Shko tek faqja e parë
16
+ go_to_last_page: Shko tek faqja e fundit
9
17
 
10
18
  pagination_compact:
11
19
  previous: '&laquo; Mbrapa'
12
20
  next: 'Tjetra &raquo;'
13
21
 
14
22
  blacklight:
23
+ application_name: 'Blacklight'
15
24
  skip_links:
16
25
  main_content: 'Shkoni tek përmbajtja kryesore'
17
26
  search_field: 'Shkoni në kërkim'
@@ -6,6 +6,14 @@ zh:
6
6
  previous: '&laquo; 上一页'
7
7
  next: '下一页 &raquo;'
8
8
  truncate: '…'
9
+ aria:
10
+ container_label: 分页链接
11
+ current_page: 当前页面,页面%{page}
12
+ go_to_page: 前往页面%{page}
13
+ go_to_previous_page: 转到上一页
14
+ go_to_next_page: 转到下一页
15
+ go_to_first_page: 转到第一页
16
+ go_to_last_page: 转到最后一页
9
17
 
10
18
  pagination_compact:
11
19
  previous: '&laquo; 上一页'