blacklight-spotlight 3.0.0.rc2 → 3.0.0.rc3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/images/blacklight/arrow-alt-circle-left.svg +1 -0
  4. data/app/assets/images/blacklight/arrow-alt-circle-right.svg +1 -0
  5. data/app/assets/javascripts/spotlight/admin/{add_new_page_button.js → add_new_button.js} +7 -0
  6. data/app/assets/javascripts/spotlight/admin/block_mixins/autocompleteable.js +4 -4
  7. data/app/assets/javascripts/spotlight/admin/blocks/browse_group_categories_block.js +88 -0
  8. data/app/assets/javascripts/spotlight/admin/blocks/pages_block.js +1 -1
  9. data/app/assets/javascripts/spotlight/admin/blocks/solr_documents_base_block.js +1 -1
  10. data/app/assets/javascripts/spotlight/admin/croppable.js +1 -1
  11. data/app/assets/javascripts/spotlight/admin/index.js +0 -2
  12. data/app/assets/javascripts/spotlight/admin/search_typeahead.js +2 -2
  13. data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +7 -0
  14. data/app/assets/javascripts/spotlight/user/browse_group_categories.js +59 -0
  15. data/app/assets/javascripts/spotlight/user/index.js +1 -0
  16. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +8 -0
  17. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +34 -1
  18. data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
  19. data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +69 -0
  20. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +1 -2
  21. data/app/controllers/concerns/spotlight/search_helper.rb +2 -8
  22. data/app/controllers/spotlight/appearances_controller.rb +0 -13
  23. data/app/controllers/spotlight/browse_controller.rb +7 -3
  24. data/app/controllers/spotlight/catalog_controller.rb +1 -1
  25. data/app/controllers/spotlight/concerns/application_controller.rb +13 -2
  26. data/app/controllers/spotlight/groups_controller.rb +80 -0
  27. data/app/controllers/spotlight/pages_controller.rb +5 -8
  28. data/app/controllers/spotlight/searches_controller.rb +4 -17
  29. data/app/helpers/spotlight/application_helper.rb +1 -1
  30. data/app/helpers/spotlight/crud_link_helpers.rb +1 -1
  31. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  32. data/app/models/sir_trevor_rails/blocks/browse_group_categories_block.rb +25 -0
  33. data/app/models/spotlight/ability.rb +2 -0
  34. data/app/models/spotlight/about_page.rb +1 -1
  35. data/app/models/spotlight/blacklight_configuration.rb +2 -1
  36. data/app/models/spotlight/exhibit.rb +14 -2
  37. data/app/models/spotlight/feature_page.rb +1 -1
  38. data/app/models/spotlight/featured_image.rb +1 -1
  39. data/app/models/spotlight/group.rb +22 -0
  40. data/app/models/spotlight/group_member.rb +11 -0
  41. data/app/models/spotlight/home_page.rb +1 -1
  42. data/app/models/spotlight/page.rb +2 -2
  43. data/app/models/spotlight/page_configurations.rb +5 -0
  44. data/app/models/spotlight/resources/iiif_manifest.rb +6 -6
  45. data/app/models/spotlight/search.rb +5 -0
  46. data/app/services/spotlight/exhibit_import_export_service.rb +50 -22
  47. data/app/views/spotlight/browse/_search.html.erb +2 -1
  48. data/app/views/spotlight/browse/index.html.erb +13 -0
  49. data/app/views/spotlight/catalog/_document.html.erb +2 -4
  50. data/app/views/spotlight/catalog/index.iiif_json.jbuilder +22 -0
  51. data/app/views/spotlight/searches/_form.html.erb +12 -0
  52. data/app/views/spotlight/searches/_group.html.erb +27 -0
  53. data/app/views/spotlight/searches/index.html.erb +58 -17
  54. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +44 -0
  55. data/app/views/spotlight/translations/_groups.html.erb +34 -0
  56. data/app/views/spotlight/translations/edit.html.erb +6 -0
  57. data/config/i18n-tasks.yml +5 -0
  58. data/config/locales/spotlight.en.yml +37 -1
  59. data/config/routes.rb +10 -0
  60. data/db/migrate/20210113092223_create_spotlight_groups.rb +23 -0
  61. data/lib/generators/spotlight/install_generator.rb +3 -3
  62. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +1 -1
  63. data/lib/spotlight/engine.rb +4 -3
  64. data/lib/spotlight/version.rb +1 -1
  65. data/spec/controllers/spotlight/browse_controller_spec.rb +23 -0
  66. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +11 -0
  67. data/spec/controllers/spotlight/groups_controller_spec.rb +103 -0
  68. data/spec/controllers/spotlight/searches_controller_spec.rb +10 -3
  69. data/spec/controllers/spotlight/view_configurations_controller_spec.rb +1 -1
  70. data/spec/examples.txt +1437 -136
  71. data/spec/factories/group.rb +17 -0
  72. data/spec/factories/searches.rb +10 -0
  73. data/spec/features/browse_category_admin_spec.rb +36 -4
  74. data/spec/features/browse_category_navigation_spec.rb +44 -0
  75. data/spec/features/browse_category_spec.rb +2 -2
  76. data/spec/features/exhibits/translation_editing_spec.rb +49 -0
  77. data/spec/features/home_page_spec.rb +4 -4
  78. data/spec/features/javascript/about_page_admin_spec.rb +1 -1
  79. data/spec/features/javascript/block_controls_spec.rb +1 -1
  80. data/spec/features/javascript/blocks/browse_group_categories_block_spec.rb +64 -0
  81. data/spec/features/javascript/browse_group_admin_spec.rb +45 -0
  82. data/spec/features/javascript/edit_in_place_spec.rb +2 -2
  83. data/spec/features/javascript/feature_page_admin_spec.rb +1 -1
  84. data/spec/helpers/spotlight/crud_link_helpers_spec.rb +3 -3
  85. data/spec/models/sir_trevor_rails/blocks/browse_group_categories_block_spec.rb +41 -0
  86. data/spec/models/spotlight/exhibit_spec.rb +8 -0
  87. data/spec/models/spotlight/group_spec.rb +19 -0
  88. data/spec/models/spotlight/role_spec.rb +1 -1
  89. data/spec/models/spotlight/search_spec.rb +30 -3
  90. data/spec/services/spotlight/exhibit_import_export_service_spec.rb +48 -1
  91. data/spec/services/spotlight/solr_document_builder_spec.rb +1 -1
  92. data/spec/spec_helper.rb +1 -1
  93. data/spec/support/features/test_features_helpers.rb +15 -0
  94. data/spec/test_app_templates/Gemfile.extra +1 -0
  95. data/spec/test_app_templates/catalog_controller.rb +6 -3
  96. data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
  97. data/spec/views/spotlight/browse/index.html.erb_spec.rb +2 -0
  98. data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
  99. data/vendor/assets/javascripts/tiny-slider.js +3218 -0
  100. data/vendor/assets/stylesheets/tiny-slider.css +1 -0
  101. metadata +339 -263
  102. data/vendor/assets/javascripts/handlebars-v1.3.0.js +0 -2746
@@ -0,0 +1,27 @@
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| %>
3
+ <% case section when nil %>
4
+ <div class="d-flex flex-grow-1">
5
+ <div>
6
+ <%= f.check_box :published, inline: true, hide_label: true %>
7
+ </div>
8
+
9
+ <div class="flex-grow-1 mx-2 main">
10
+ <h4 class="card-title h6 mb-0" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
11
+ <a href="#edit-in-place" class="field-label edit-in-place"><%= group.title %></a>
12
+ <%= f.hidden_field :title, value: group.title , class: 'form-control form-control-sm title-field', data: {:"edit-field-target" => 'true'} %>
13
+ </h4>
14
+
15
+ <div class="card-text">
16
+ <div class=""><%= t :'spotlight.searches.group.category_count', count: group.searches.count %> <%= t :'spotlight.searches.group.unpublished_count', count: group.searches.unpublished.count %> &bull; <%= link_to t(:'helpers.action.view'), exhibit_browse_groups_path(current_exhibit, group) %></div>
17
+ <%= f.hidden_field :id %>
18
+ <%= f.hidden_field :weight, data: {property: "weight"} %>
19
+ </div>
20
+ </div>
21
+ <div class="flex m-2">
22
+ <div class="card-text">
23
+ <%= exhibit_delete_link(group) %>
24
+ </div>
25
+ </div>
26
+ <% end %>
27
+ <% end %>
@@ -3,7 +3,6 @@
3
3
  <% end %>
4
4
 
5
5
  <%= curation_page_title %>
6
- <h2><%= t(:'.categories_header') %></h2>
7
6
 
8
7
  <% if @searches.empty? %>
9
8
  <%= t :'.no_saved_searches' %>
@@ -13,24 +12,66 @@
13
12
  </p>
14
13
  <% end %>
15
14
  <% else %>
16
- <p class="instructions"><%= t(:'.instructions') %></p>
17
- <% unless @exhibit.searchable? %>
18
- <p class="instructions alert-warning">
19
- <%= t(:'.not_searchable_html', href: link_to(t(:'spotlight.configuration.sidebar.search_configuration'), spotlight.edit_exhibit_search_configuration_path(@exhibit))) %>
20
- </p>
21
- <% end %>
22
- <%= bootstrap_form_for @exhibit, url: update_all_exhibit_searches_path(@exhibit), layout: :horizontal, control_col: 'col-sm-10' do |f| %>
15
+ <div role="tabpanel">
16
+ <ul class="nav nav-tabs" role="tablist">
17
+ <li role="presentation" class="nav-item">
18
+ <a href="#browse-categories" aria-controls="browse-categories" role="tab" data-toggle="tab" class="nav-link active"><%= t(:'.categories_header') %></a>
19
+ </li>
23
20
 
24
- <div class="panel-group dd search_admin" id="nested-pages" data-behavior="nestable" data-max-depth="1">
25
- <ol class="dd-list">
26
- <%= f.fields_for :searches do |p| %>
27
- <%= render partial: 'search', locals: { f: p} %>
21
+ <li role="presentation" class="nav-item">
22
+ <a href="#browse-groups" aria-controls="browse-groups" role="tab" data-toggle="tab" class="nav-link"><%= t(:'.groups_header') %></a>
23
+ </li>
24
+ </ul>
25
+ <div class="tab-content">
26
+ <div role="tabpanel" class="tab-pane active" id="browse-categories">
27
+ <p class="instructions"><%= t(:'.categories_instructions') %></p>
28
+ <% unless @exhibit.searchable? %>
29
+ <p class="instructions alert-warning">
30
+ <%= t(:'.not_searchable_html', href: link_to(t(:'spotlight.configuration.sidebar.search_configuration'), spotlight.edit_exhibit_search_configuration_path(@exhibit))) %>
31
+ </p>
28
32
  <% end %>
29
- </ol>
30
- </div>
33
+ <%= bootstrap_form_for @exhibit, url: update_all_exhibit_searches_path(@exhibit), layout: :horizontal, control_col: 'col-sm-10' do |f| %>
31
34
 
32
- <div class="float-right">
33
- <%= submit_tag t(:'helpers.action.update_all'), class: "btn btn-primary" %>
35
+ <div class="panel-group dd search_admin" id="nested-pages" data-behavior="nestable" data-max-depth="1">
36
+ <ol class="dd-list">
37
+ <%= f.fields_for :searches do |p| %>
38
+ <%= render partial: 'search', locals: { f: p} %>
39
+ <% end %>
40
+ </ol>
41
+ </div>
42
+
43
+ <div class="float-right">
44
+ <%= submit_tag t(:'helpers.action.update_all'), class: "btn btn-primary" %>
45
+ </div>
46
+ <% end %>
47
+ </div>
48
+ <div role="tabpanel" class="tab-pane" id="browse-groups">
49
+ <div class="instructions"><%= t(:'.groups_instructions_html') %></div>
50
+ <%= bootstrap_form_for @exhibit, url: update_all_exhibit_groups_path(@exhibit), layout: :horizontal, control_col: 'col-sm-10' do |f| %>
51
+
52
+ <div class="panel-group dd search_admin" id="nested-pages" data-behavior="nestable" data-max-depth="1">
53
+ <ol class="dd-list">
54
+ <%= f.fields_for :groups do |p| %>
55
+ <%= render partial: 'group', locals: { f: p} %>
56
+ <% end %>
57
+ </ol>
58
+ </div>
59
+
60
+ <div class="float-right">
61
+ <%= submit_tag t(:'helpers.action.update_all'), class: "btn btn-primary" %>
62
+ </div>
63
+ <% end %>
64
+ <%= form_for :group, url: spotlight.exhibit_groups_path(current_exhibit), html: {class: "expanded-add-button"} do |f|%>
65
+ <a href='#add-new' class="btn btn-primary" data-turbolinks="false" data-expanded-add-button="true" data-field-target="[data-title-field]">
66
+ <%= t(:'.add_new_group') %> <%= blacklight_icon('chevron_right') %>
67
+ <span data-title-field="true" class="input-field">
68
+ <%= f.text_field(:title) %>
69
+ <%= f.submit t(:'.save'), data: {behavior: "save"} %>
70
+ <%= f.submit t(:'.cancel'), data: {behavior: "cancel"} %>
71
+ </span>
72
+ </a>
73
+ <%- end -%>
74
+ </div>
34
75
  </div>
35
- <% end %>
76
+ </div>
36
77
  <% end %>
@@ -0,0 +1,44 @@
1
+ <% if browse_group_categories_block.groups? %>
2
+ <% browse_group_categories_block.groups.each do |group| %>
3
+ <div class="browse-group-categories-block" data-browse-group-categories-count="<%= group.searches.count %>">
4
+ <div class="d-flex flex-column flex-md-row py-2">
5
+ <div class="d-flex justify-content-between align-items-end">
6
+ <h2 class="m-0"><%= group.title %></h2>
7
+ <div class="pl-5">
8
+ <%= link_to 'View all', exhibit_browse_groups_path(current_exhibit, group) %>
9
+ </div>
10
+ </div>
11
+ <% if group.searches.count > 1 %>
12
+ <ul class="browse-group-categories-controls p-0 pt-2 pt-md-0 ml-md-auto mb-0 d-flex justify-content-center align-items-end">
13
+ <li class="prev px-1">
14
+ <%= blacklight_icon 'arrow-alt-circle-left' %>
15
+ </li>
16
+ <li class="next px-1">
17
+ <%= blacklight_icon 'arrow-alt-circle-right' %>
18
+ </li>
19
+ </ul>
20
+ <% end %>
21
+ </div>
22
+ <div class="spotlight-flexbox browse-categories categories-<%= [group.searches.count, (@page.display_sidebar? ? 3 : 4)].min %>" data-browse-group-categories-carousel data-sidebar='<%= @page.display_sidebar? %>' data-browse-group-categories-count="<%= group.searches.count %>">
23
+ <% group.searches.published.each_with_index do |search, index| %>
24
+ <div class="box category-1 justify-content-center justify-content-md-start">
25
+ <%= link_to spotlight.exhibit_browse_group_path(current_exhibit, group, search), class: 'justify-content-center' do %>
26
+ <div class="browse-category" style='background-image: linear-gradient(rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.5)), url("<%= search.thumbnail.iiif_url if search.thumbnail %>")'>
27
+ <div class="category-caption">
28
+ <p class="category-title">
29
+ <%= search.title %>
30
+ <% if search.subtitle.present? %><span class="category-subtitle"><%= search.subtitle %></span><% end %>
31
+ </p>
32
+
33
+ <% if browse_group_categories_block.display_item_counts? %>
34
+ <span class="item-count"><%= t(:'.items', count: search.count) %></span>
35
+ <% end %>
36
+ </div>
37
+ </div>
38
+ <% end %>
39
+ </div>
40
+ <% end %>
41
+ </div>
42
+ </div>
43
+ <% end %>
44
+ <% end %>
@@ -0,0 +1,34 @@
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'groups' %>" id="groups">
2
+ <%= bootstrap_form_for current_exhibit, url: spotlight.exhibit_translations_path(current_exhibit), layout: :horizontal do |f| %>
3
+ <% # Add hidden fields for the language and tab so the redirect knows how to come back here %>
4
+ <%= hidden_field_tag :language, @language %>
5
+ <%= hidden_field_tag :tab, 'groups' %>
6
+
7
+ <% current_exhibit.groups.each do |group| %>
8
+ <% title_translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{group.slug}.title", locale: @language) %>
9
+ <%= f.fields_for :translations, title_translation do |translation_fields| %>
10
+ <%= translation_fields.hidden_field :key %>
11
+ <%= translation_fields.hidden_field :locale %>
12
+ <div data-translation-progress-item="true" class="row form-group browse-group-title">
13
+ <%= translation_fields.label :value, group[:title], class: 'col-form-label col-12 col-sm-2' %>
14
+ <div class="col-11 col-sm-9">
15
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
16
+ </div>
17
+ <div class="col-1">
18
+ <% if title_translation.value.present? %>
19
+ <span data-translation-present="true">
20
+ <%= blacklight_icon('check', classes: 'translation-complete') %>
21
+ </span>
22
+ <% end %>
23
+ </div>
24
+ </div>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <div class="form-actions">
29
+ <div class="primary-actions">
30
+ <%= f.submit nil, class: 'btn btn-primary' %>
31
+ </div>
32
+ </div>
33
+ <% end %>
34
+ </div>
@@ -41,6 +41,11 @@
41
41
  <%= t('spotlight.translations.browse_categories.label') %> <span class="badge"></span>
42
42
  </a>
43
43
  </li>
44
+ <li class="nav-item">
45
+ <a href="#groups" class="nav-link <%= 'active' if @tab == 'groups' %>" aria-controls="groups" role="tab" data-toggle="tab" data-behavior="translation-progress">
46
+ <%= t('spotlight.translations.groups.label') %> <span class="badge"></span>
47
+ </a>
48
+ </li>
44
49
  <li class="nav-item">
45
50
  <a href="#pages" class="nav-link <%= 'active' if @tab == 'pages' %>" aria-controls="pages" role="tab" data-toggle="tab" data-behavior="translation-progress">
46
51
  <%= t('spotlight.translations.pages.label') %> <span class="badge"></span>
@@ -54,6 +59,7 @@
54
59
  <%= render 'search_fields' %>
55
60
  <%= render 'browse_categories' %>
56
61
  <%= render 'pages' %>
62
+ <%= render 'groups' %>
57
63
  </div>
58
64
  </div>
59
65
  </div>
@@ -39,6 +39,8 @@ ignore_unused:
39
39
  - activerecord.attributes.spotlight/masthead.display # app/views/spotlight/appearances/edit.html.erb
40
40
  - activerecord.attributes.spotlight/custom_field.is_multiple # app/views/spotlight/custom_fields/_form.html.erb
41
41
  - activerecord.attributes.spotlight/custom_search_field.field # app/views/spotlight/custom_search_fields/_form.html.erb
42
+ - activerecord.models.spotlight/group # Used in flash messages around the app to rename Group to Browse group
43
+ - activerecord.models.spotlight/search # Used in flash messages around the app to rename Search to Browse category
42
44
  - helpers.label.spotlight/filter.{field,value} # app/views/spotlight/filters/_form.html.erb
43
45
  - spotlight.catalog.admin.{title,header} # app/helpers/spotlight/title_helper.rb
44
46
  - spotlight.{contacts,pages,searches}.edit.{title,header} # app/helpers/spotlight/title_helper.rb
@@ -49,14 +51,17 @@ ignore_unused:
49
51
  - spotlight.featured_images.upload_form.{non_iiif_alert_html,source.exhibit.help,source.exhibit.label} # app/views/spotlight/featured_images/_form.html.erb
50
52
  - spotlight.feature_pages.page_options.published # app/views/spotlight/feature_pages/_page_options.html.erb
51
53
  - spotlight.{exhibits,custom_fields,custom_search_fields}.{new,edit}.header # configuration_page_title
54
+ - spotlight.{searches}.{group}.{view}
52
55
  - helpers.submit.custom_field.{batch_error,batch_updated,create,submit,update} # Generic repeated template
53
56
  - helpers.submit.custom_search_field.{batch_error,batch_updated,create,submit,update} # Generic repeated template
54
57
  - helpers.submit.exhibit.{batch_error,batch_updated,create,submit,update} # Generic repeated template
58
+ - helpers.submit.group.{destroyed,updated} # Generic helper that is used
55
59
  - helpers.submit.search.{create,submit,update} # Generic repeated template
56
60
  - helpers.submit.site.{batch_error,batch_updated,create,created,destroyed,submit,update} # Generic repeated template
57
61
  - helpers.submit.filter.{batch_error,batch_updated,create,created,destroyed,submit,update} # Generic repeated template
58
62
  - helpers.action.destroy_are_you_sure # app/helpers/spotlight/crud_link_helpers.rb
59
63
  - helpers.action.spotlight/role.{create,destroy} # app/views/spotlight/roles/index.html.erb
64
+ - helpers.action.spotlight/group.destroy # app/views/spotlight/searches/_group.html.erb
60
65
  - helpers.action.{edit,edit_long,new,view} # app/helpers/spotlight/crud_link_helpers.rb
61
66
  - helpers.action.spotlight/search.edit_long # app/views/spotlight/searches/_search.html.erb
62
67
  - spotlight.about_pages.page_options.published # app/views/spotlight/about_pages/_page_options.html.erb
@@ -24,6 +24,8 @@ en:
24
24
  models:
25
25
  spotlight:
26
26
  page: Page
27
+ spotlight/group: Browse group
28
+ spotlight/search: Browse category
27
29
  cancel: Cancel
28
30
  drag: Drag
29
31
  helpers:
@@ -44,6 +46,8 @@ en:
44
46
  create: Add new field
45
47
  spotlight/custom_search_field:
46
48
  create: Add new field
49
+ spotlight/group:
50
+ destroy: Delete group
47
51
  spotlight/role:
48
52
  create: Add a new user
49
53
  destroy: Remove from site
@@ -101,6 +105,12 @@ en:
101
105
  created: The %{model} was created.
102
106
  destroyed: The %{model} was deleted.
103
107
  updated: The %{model} was successfully updated.
108
+ group:
109
+ batch_error: There was an error updating the requested %{model}.
110
+ batch_updated: "%{model} were successfully updated."
111
+ created: The %{model} was created.
112
+ destroyed: The %{model} was deleted.
113
+ updated: The %{model} was successfully updated.
104
114
  language:
105
115
  create: Add language
106
116
  created: The %{model} was created.
@@ -403,6 +413,8 @@ en:
403
413
  published:
404
414
  help_block: ''
405
415
  uneditable_non_default_language: This field is not editable in the current language. Switch to the default language to edit it.
416
+ groups:
417
+ all: All
406
418
  import:
407
419
  button: Import data
408
420
  heading: Import data
@@ -691,6 +703,9 @@ en:
691
703
  title: Curation - browse
692
704
  form:
693
705
  default_index_view_type: Default view
706
+ group:
707
+ help: You can add this browse category to any number of browse groups. When you add a browse category to a group it will be displayed when an exhibit visitor selects that browse group’s filter button on the Browse landing page.
708
+ help_no_groups: You cannot add this browse category to a browse group because no browse groups have been created. To create a browse group, use the Browse groups tab on the Curation > Browse page.
694
709
  masthead:
695
710
  help: You can select and crop an image to use as a browse category-specific masthead, instead of the default site masthead, for this browse category's detail page.
696
711
  help_secondary: To create a browse category-specific masthead, you should use an image that is at least 120 pixels tall and 1200 pixels wide. For best results use an image at least 1800 pixels wide. You can crop larger images using the cropping tool below.
@@ -700,16 +715,31 @@ en:
700
715
  help_block: Displays a search box that enables users to search within the browse category results
701
716
  label: Search box
702
717
  search_description: Description
718
+ search_group: Group
703
719
  search_masthead: Masthead
704
720
  search_thumbnail: Thumbnail
705
721
  thumbnail:
706
722
  help: You can select and crop an image to visually represent this search.
723
+ group:
724
+ category_count:
725
+ one: "%{count} category"
726
+ other: "%{count} categories"
727
+ unpublished_count:
728
+ one: "(%{count} unpublished)"
729
+ other: "(%{count} unpublished)"
730
+ zero: ''
731
+ view: View
707
732
  index:
733
+ add_new_group: Add new group
734
+ cancel: Cancel
708
735
  categories_header: Browse categories
736
+ categories_instructions: Use the Save search button on a search results page to create a new browse category. Select the categories you want to be displayed on the browse landing page. Drag and drop categories to change the order in which they appear on that page.
737
+ groups_header: Browse groups
738
+ groups_instructions_html: "<p>Optionally, you can create groups to organize your exhibits’ browse categories and enable exhibit visitors to filter browse categories by group. Drag and drop browse groups to change the order in which their filter buttons are displayed.</p><p>To add a browse category to a browse group, edit the browse category from the Browse categories tab.</p>"
709
739
  header: Browse
710
- instructions: Use the Save search button on a search results page to create a new browse category. Select the categories you want to be displayed on the browse landing page. Drag and drop categories to change the order in which they appear on that page.
711
740
  no_saved_searches: You can save search results while in curation mode to create browse categories, which will be displayed here.
712
741
  not_searchable_html: This exhibit is not currently searchable. To perform searches that can be saved as additional browse categories, temporarily turn on the Display search box option in the Options section of the Configuration > %{href} page.
742
+ save: Save
713
743
  title: Curation - browse
714
744
  search:
715
745
  item_count:
@@ -731,6 +761,10 @@ en:
731
761
  items:
732
762
  one: "%{count} item"
733
763
  other: "%{count} items"
764
+ browse_group_categories_block:
765
+ items:
766
+ one: "%{count} item"
767
+ other: "%{count} items"
734
768
  link_to_search_block:
735
769
  items:
736
770
  one: "%{count} item"
@@ -784,6 +818,8 @@ en:
784
818
  curated_features: Curated features
785
819
  home: Home
786
820
  label: Main menu
821
+ groups:
822
+ label: Browse groups
787
823
  import:
788
824
  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.
789
825
  export_current_locale: Export %{language}
data/config/routes.rb CHANGED
@@ -100,6 +100,15 @@ Spotlight::Engine.routes.draw do
100
100
  end
101
101
  end
102
102
  resources :browse, only: %i[index show]
103
+ get 'browse/group/:group_id', to: 'browse#index', as: 'browse_groups'
104
+ get 'browse/group/:group_id/:id', to: 'browse#show', as: 'browse_group'
105
+
106
+ resources :groups, except: %i[show] do
107
+ collection do
108
+ patch :update_all
109
+ end
110
+ end
111
+
103
112
  resources :tags, only: %i[index destroy]
104
113
 
105
114
  resources :contacts, only: %i[edit update destroy]
@@ -149,6 +158,7 @@ Spotlight::Engine.routes.draw do
149
158
  patch 'import'
150
159
  end
151
160
  end
161
+ get 'iiif/collection' => 'catalog#index', defaults: { q: '*:*', format: :iiif_json }
152
162
  end
153
163
 
154
164
  get '/:exhibit_id' => 'home_pages#show', as: :exhibit_root
@@ -0,0 +1,23 @@
1
+ class CreateSpotlightGroups < ActiveRecord::Migration[5.2]
2
+ def self.up
3
+ create_table :spotlight_groups do |t|
4
+ t.string :slug
5
+ t.text :title
6
+ t.references :exhibit
7
+ t.integer :weight, default: 50
8
+ t.boolean :published
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ create_table :spotlight_groups_members, id: false do |t|
14
+ t.references :group
15
+ t.references :member, polymorphic: true
16
+ end
17
+ end
18
+
19
+ def self.down
20
+ drop_table :spotlight_groups
21
+ drop_table :spotlight_groups_members
22
+ end
23
+ end
@@ -17,8 +17,8 @@ module Spotlight
17
17
  gem 'coffee-rails', '~> 4.2'
18
18
  gem 'uglifier', '>= 1.3.0'
19
19
 
20
- append_to_file 'app/assets/config/manifest.js', '//= link_directory ../javascripts .js'
21
- append_to_file 'app/assets/javascripts/application.js', '//= require_tree .'
20
+ append_to_file 'app/assets/config/manifest.js', "\n//= link_directory ../javascripts .js\n"
21
+ append_to_file 'app/assets/javascripts/application.js', "\n//= require_tree .\n"
22
22
  gsub_file 'app/views/layouts/application.html.erb', /pack/, 'include'
23
23
  inject_into_file 'config/environments/production.rb', after: ' # config.assets.css_compressor = :sass' do
24
24
  "\n config.assets.js_compressor = :uglifier"
@@ -125,7 +125,7 @@ module Spotlight
125
125
  end
126
126
 
127
127
  def add_osd_viewer
128
- gem 'blacklight-gallery', '~> 1.1'
128
+ gem 'blacklight-gallery', '~> 3.0'
129
129
  generate 'blacklight_gallery:install'
130
130
  end
131
131
 
@@ -73,7 +73,7 @@
73
73
  # These are set by default by Spotlight's configuration,
74
74
  # but you can customize them here, or in the SirTrevorRails::Block#custom_block_types method
75
75
  # Spotlight::Engine.config.sir_trevor_widgets = %w(
76
- # Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse
76
+ # Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse BrowseGroupCategories
77
77
  # FeaturedPages SolrDocuments SolrDocumentsCarousel SolrDocumentsEmbed
78
78
  # SolrDocumentsFeatures SolrDocumentsGrid SearchResults
79
79
  # )
@@ -38,8 +38,8 @@ module Spotlight
38
38
  require 'github/markup'
39
39
  require 'sir_trevor_rails'
40
40
  require 'openseadragon'
41
+ require 'handlebars_assets'
41
42
  require 'sprockets/es6'
42
- require 'almond-rails'
43
43
 
44
44
  config.assets.precompile += %w[spotlight/fallback/*.png]
45
45
 
@@ -55,6 +55,7 @@ module Spotlight
55
55
  require 'acts-as-taggable-on'
56
56
 
57
57
  Mime::Type.register 'application/solr+json', :solr_json
58
+ Mime::Type.register 'application/iiif+json', :iiif_json
58
59
  end
59
60
 
60
61
  initializer 'spotlight.factories', after: 'factory_bot.set_factory_paths' do
@@ -64,7 +65,7 @@ module Spotlight
64
65
  initializer 'spotlight.assets.precompile' do |app|
65
66
  app.config.assets.precompile += %w[spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg]
66
67
 
67
- Sprockets::ES6.configuration = { 'modules' => 'amd', 'moduleIds' => true }
68
+ Sprockets::ES6.configuration = { 'modules' => 'umd', 'moduleIds' => true }
68
69
  # When we upgrade to Sprockets 4, we can ditch sprockets-es6 and config AMD
69
70
  # in this way:
70
71
  # https://github.com/rails/sprockets/issues/73#issuecomment-139113466
@@ -267,7 +268,7 @@ module Spotlight
267
268
  # Added here for backwards compatability with SirTrevor 0.6
268
269
  # and apps who have customized their avaialble widgets
269
270
  config.sir_trevor_widgets = %w[
270
- Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse LinkToSearch
271
+ Heading Text List Quote Iframe Video Oembed Rule UploadedItems Browse BrowseGroupCategories LinkToSearch
271
272
  FeaturedPages SolrDocuments SolrDocumentsCarousel SolrDocumentsEmbed
272
273
  SolrDocumentsFeatures SolrDocumentsGrid SearchResults
273
274
  ]