blacklight-spotlight 3.0.0.alpha.6 → 3.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/spotlight/admin/blocks/browse_block.js +55 -1
  4. data/app/assets/javascripts/spotlight/admin/blocks/uploaded_items_block.js +7 -2
  5. data/app/assets/javascripts/spotlight/admin/crop.es6 +11 -0
  6. data/app/assets/javascripts/spotlight/admin/sir-trevor/block_controls.js +21 -12
  7. data/app/assets/javascripts/spotlight/admin/sir-trevor/locales.js +3 -2
  8. data/app/assets/stylesheets/spotlight/_accessibility.scss +8 -0
  9. data/app/assets/stylesheets/spotlight/_browse.scss +16 -0
  10. data/app/assets/stylesheets/spotlight/_curation.scss +9 -16
  11. data/app/assets/stylesheets/spotlight/_featured_browse_categories_block.scss +7 -4
  12. data/app/assets/stylesheets/spotlight/_header.scss +1 -1
  13. data/app/assets/stylesheets/spotlight/_item_text_block.scss +6 -0
  14. data/app/assets/stylesheets/spotlight/_nestable.scss +4 -0
  15. data/app/assets/stylesheets/spotlight/_pages.scss +3 -1
  16. data/app/assets/stylesheets/spotlight/_report_a_problem.scss +5 -2
  17. data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -0
  18. data/app/assets/stylesheets/spotlight/_translations.scss +1 -0
  19. data/app/controllers/concerns/spotlight/base.rb +8 -0
  20. data/app/controllers/spotlight/admin_users_controller.rb +4 -1
  21. data/app/controllers/spotlight/appearances_controller.rb +1 -0
  22. data/app/controllers/spotlight/browse_controller.rb +1 -1
  23. data/app/controllers/spotlight/catalog_controller.rb +2 -2
  24. data/app/controllers/spotlight/exhibits_controller.rb +4 -3
  25. data/app/controllers/spotlight/featured_images_controller.rb +1 -1
  26. data/app/controllers/spotlight/pages_controller.rb +1 -5
  27. data/app/controllers/spotlight/resources/csv_upload_controller.rb +1 -1
  28. data/app/controllers/spotlight/searches_controller.rb +3 -2
  29. data/app/controllers/spotlight/sites_controller.rb +8 -2
  30. data/app/controllers/spotlight/translations_controller.rb +46 -0
  31. data/app/helpers/spotlight/crop_helper.rb +4 -1
  32. data/app/helpers/spotlight/title_helper.rb +12 -2
  33. data/app/jobs/spotlight/add_uploads_from_csv.rb +30 -5
  34. data/app/mailers/spotlight/indexing_complete_mailer.rb +3 -2
  35. data/app/models/concerns/spotlight/translatables.rb +17 -1
  36. data/app/models/spotlight/about_page.rb +3 -1
  37. data/app/models/spotlight/contact.rb +1 -1
  38. data/app/models/spotlight/custom_field.rb +3 -3
  39. data/app/models/spotlight/exhibit.rb +4 -2
  40. data/app/models/spotlight/feature_page.rb +3 -1
  41. data/app/models/spotlight/featured_image.rb +29 -12
  42. data/app/models/spotlight/home_page.rb +3 -1
  43. data/app/models/spotlight/main_navigation.rb +2 -2
  44. data/app/models/spotlight/masthead.rb +1 -1
  45. data/app/models/spotlight/page.rb +7 -3
  46. data/app/models/spotlight/page_configurations.rb +1 -0
  47. data/app/models/spotlight/page_content.rb +2 -0
  48. data/app/models/spotlight/resources/csv_upload.rb +2 -1
  49. data/app/models/spotlight/resources/iiif_manifest.rb +2 -0
  50. data/app/models/spotlight/resources/upload.rb +1 -1
  51. data/app/models/spotlight/search.rb +5 -1
  52. data/app/models/spotlight/solr_document_sidecar.rb +7 -5
  53. data/app/models/spotlight/temporary_image.rb +8 -0
  54. data/app/services/spotlight/exhibit_import_export_service.rb +454 -0
  55. data/app/services/spotlight/solr_document_builder.rb +1 -0
  56. data/app/values/custom_field_name.rb +1 -0
  57. data/app/views/catalog/_save_search.html.erb +1 -1
  58. data/app/views/layouts/spotlight/spotlight.html.erb +1 -1
  59. data/app/views/shared/_site_sidebar.html.erb +1 -1
  60. data/app/views/spotlight/about_pages/_contact.html.erb +15 -17
  61. data/app/views/spotlight/admin_users/index.html.erb +1 -1
  62. data/app/views/spotlight/appearances/edit.html.erb +1 -23
  63. data/app/views/spotlight/browse/_search.html.erb +3 -2
  64. data/app/views/spotlight/browse/_search_title.html.erb +2 -1
  65. data/app/views/spotlight/exhibits/new.html.erb +1 -1
  66. data/app/views/spotlight/feature_pages/_sidebar.html.erb +9 -5
  67. data/app/views/spotlight/indexing_complete_mailer/documents_indexed.html.erb +9 -0
  68. data/app/views/spotlight/pages/_form.html.erb +2 -2
  69. data/app/views/spotlight/pages/_page.html.erb +19 -35
  70. data/app/views/spotlight/search_configurations/_facets.html.erb +15 -34
  71. data/app/views/spotlight/search_configurations/_search_fields.html.erb +4 -19
  72. data/app/views/spotlight/search_configurations/_sort.html.erb +8 -22
  73. data/app/views/spotlight/searches/_form.html.erb +1 -0
  74. data/app/views/spotlight/searches/_search.html.erb +31 -29
  75. data/app/views/spotlight/shared/_dd3_item.html.erb +56 -0
  76. data/app/views/spotlight/shared/_honeypot_field.html.erb +4 -0
  77. data/app/views/spotlight/shared/_report_a_problem.html.erb +7 -10
  78. data/app/views/spotlight/sir_trevor/blocks/_browse_block.html.erb +1 -0
  79. data/app/views/spotlight/sir_trevor/blocks/_uploaded_items_block.html.erb +7 -1
  80. data/app/views/spotlight/sites/edit.html.erb +1 -1
  81. data/app/views/spotlight/sites/edit_exhibits.html.erb +1 -1
  82. data/app/views/spotlight/translations/_browse_categories.html.erb +29 -3
  83. data/app/views/spotlight/translations/_general.html.erb +7 -7
  84. data/app/views/spotlight/translations/_import.html.erb +24 -0
  85. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  86. data/app/views/spotlight/translations/_page.html.erb +5 -5
  87. data/app/views/spotlight/translations/_pages.html.erb +4 -4
  88. data/app/views/spotlight/translations/_pages_table.html.erb +5 -5
  89. data/app/views/spotlight/translations/_search_fields.html.erb +3 -3
  90. data/app/views/spotlight/translations/edit.html.erb +8 -6
  91. data/app/views/spotlight/translations/show.yaml.yamlbuilder +81 -0
  92. data/config/i18n-tasks.yml +2 -0
  93. data/config/locales/spotlight.ar.yml +47 -24
  94. data/config/locales/spotlight.en.yml +82 -67
  95. data/config/routes.rb +6 -1
  96. data/db/migrate/20200403161512_add_subtitle_to_searches.rb +7 -0
  97. data/lib/generators/spotlight/install_generator.rb +22 -1
  98. data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +10 -0
  99. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +2 -0
  100. data/lib/spotlight/engine.rb +26 -0
  101. data/lib/spotlight/upload_field_config.rb +1 -0
  102. data/lib/spotlight/version.rb +1 -1
  103. data/spec/controllers/spotlight/browse_controller_spec.rb +1 -1
  104. data/spec/controllers/spotlight/home_pages_controller_spec.rb +1 -1
  105. data/spec/controllers/spotlight/resources/csv_upload_controller_spec.rb +4 -4
  106. data/spec/controllers/spotlight/resources/upload_controller_spec.rb +2 -2
  107. data/spec/controllers/spotlight/translations_controller_spec.rb +53 -2
  108. data/spec/examples.txt +1410 -1389
  109. data/spec/factories/featured_images.rb +4 -0
  110. data/spec/features/add_contacts_spec.rb +1 -1
  111. data/spec/features/browse_category_admin_spec.rb +2 -2
  112. data/spec/features/create_exhibit_spec.rb +6 -6
  113. data/spec/features/dashboard_spec.rb +5 -5
  114. data/spec/features/exhibits/administration_spec.rb +3 -3
  115. data/spec/features/exhibits/language_create_edit_spec.rb +3 -3
  116. data/spec/features/exhibits/translation_editing_spec.rb +2 -2
  117. data/spec/features/home_page_spec.rb +9 -0
  118. data/spec/features/javascript/block_controls_spec.rb +2 -0
  119. data/spec/features/javascript/blocks/uploaded_items_block_spec.rb +4 -1
  120. data/spec/features/report_a_problem_spec.rb +5 -4
  121. data/spec/helpers/spotlight/pages_helper_spec.rb +2 -2
  122. data/spec/helpers/spotlight/title_helper_spec.rb +13 -0
  123. data/spec/i18n_spec.rb +0 -2
  124. data/spec/jobs/spotlight/add_uploads_from_csv_spec.rb +13 -1
  125. data/spec/mailers/spotlight/indexing_complete_mailer_spec.rb +11 -1
  126. data/spec/models/solr_document_spec.rb +2 -3
  127. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -0
  128. data/spec/models/spotlight/exhibit_spec.rb +9 -1
  129. data/spec/models/spotlight/feature_page_spec.rb +0 -5
  130. data/spec/models/spotlight/featured_image_spec.rb +27 -0
  131. data/spec/models/spotlight/page_spec.rb +6 -1
  132. data/spec/models/spotlight/resources/upload_spec.rb +43 -79
  133. data/spec/models/spotlight/role_spec.rb +2 -2
  134. data/spec/{serializers/spotlight/exhibit_export_serializer_spec.rb → services/spotlight/exhibit_import_export_service_spec.rb} +120 -22
  135. data/spec/services/spotlight/iiif_resource_resolver_spec.rb +1 -1
  136. data/spec/test_app_templates/Gemfile.extra +0 -3
  137. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +1 -0
  138. data/spec/views/spotlight/metadata_configurations/_metadata_field.html.erb_spec.rb +3 -3
  139. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +1 -1
  140. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +9 -10
  141. data/spec/views/spotlight/translations/_import.html.erb_spec.rb +24 -0
  142. data/vendor/assets/javascripts/leaflet-iiif.js +46 -21
  143. metadata +69 -34
  144. data/app/serializers/spotlight/exhibit_export_serializer.rb +0 -205
  145. data/app/serializers/spotlight/featured_image_representer.rb +0 -29
  146. data/app/serializers/spotlight/main_navigation_representer.rb +0 -13
  147. data/app/serializers/spotlight/page_representer.rb +0 -33
@@ -8,6 +8,7 @@ module Spotlight
8
8
  end
9
9
 
10
10
  attr_reader :resource
11
+
11
12
  delegate :exhibit, :document_model, to: :resource
12
13
 
13
14
  ##
@@ -5,6 +5,7 @@
5
5
  class CustomFieldName
6
6
  delegate :readonly_field?, :configuration, :field_type, to: :custom_field
7
7
  attr_reader :custom_field
8
+
8
9
  def initialize(custom_field)
9
10
  @custom_field = custom_field
10
11
  end
@@ -12,7 +12,7 @@
12
12
  <div class="modal-body">
13
13
  <%= f.text_field :title, label: t(:'spotlight.saved_search.title') %>
14
14
  <%= label_tag :id, t(:'spotlight.saved_search.id'), class: 'col-form-label' %>
15
- <%= select_tag :id, options_for_select(current_exhibit.searches.map { |s| [s.title, s.id] }), include_blank: true, class: 'form-control' %>
15
+ <%= select_tag :id, options_for_select(current_exhibit.searches.map { |s| [s.full_title, s.id] }), include_blank: true, class: 'form-control' %>
16
16
  <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:qt, :page, :utf8)) %>
17
17
  </div>
18
18
  <div class="modal-footer d-flex flex-row-reverse justify-content-start">
@@ -8,7 +8,7 @@
8
8
  <%= content_for(:sidebar) %>
9
9
  </aside>
10
10
  <% else %>
11
- <section class="col-md-12">
11
+ <section id="content" class="col-md-12">
12
12
  <%= yield %>
13
13
  </section>
14
14
  <% end %>
@@ -14,6 +14,6 @@
14
14
  </ul>
15
15
 
16
16
  <ul class="nav sidenav nav-pills nav-stacked">
17
- <li class="nav-item"><%= link_to t(:'spotlight.sites.new.page_title'), spotlight.new_exhibit_path, class: 'btn btn-outline-secondary btn-nav', role: 'button' if can? :create, Spotlight::Exhibit %></li>
17
+ <li class="nav-item"><%= link_to t(:'spotlight.exhibits.new.page_title'), spotlight.new_exhibit_path, class: 'btn btn-outline-secondary btn-nav', role: 'button' if can? :create, Spotlight::Exhibit %></li>
18
18
  </ul>
19
19
  <% end %>
@@ -1,18 +1,16 @@
1
- <li class="dd-item dd3-item" data-id="<%= f.object.id %>" itemscope itemtype="http://schema.org/Person">
2
- <div class="card d-flex dd3-content">
3
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
4
- <div class="card-body page d-flex">
5
- <div class="flex-grow-1 d-flex">
6
-
7
- <%= f.check_box :show_in_sidebar, hide_label: true, inline: true %>
8
- <%= f.hidden_field :id %>
9
- <%= f.hidden_field :weight, data: {property: "weight"} %>
10
- <%= render partial: "contact_properties", locals: {contact: f.object} %>
11
- </div>
12
- <div class="contact-links page-links">
13
- <%= exhibit_edit_link f.object %> &middot;
14
- <%= exhibit_delete_link f.object %>
15
- </div>
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| %>
2
+ <% case section when nil %>
3
+ <div class="d-flex flex-grow-1">
4
+ <%= f.check_box :show_in_sidebar, hide_label: true, inline: true %>
5
+ <%= f.hidden_field :id %>
6
+ <%= f.hidden_field :weight, data: {property: "weight"} %>
7
+ <%= render partial: "contact_properties", locals: {contact: f.object} %>
16
8
  </div>
17
- </div>
18
- </li>
9
+ <% when :additional_options %>
10
+ <div class="contact-links page-links">
11
+ <%= exhibit_edit_link f.object %> &middot;
12
+ <%= exhibit_delete_link f.object %>
13
+ </div>
14
+ <% else %>
15
+ <% end %>
16
+ <% end %>
@@ -1,4 +1,4 @@
1
- <%= page_title(t('.section'), t('.page_title')) %>
1
+ <%= page_title(t('.page_title')) %>
2
2
  <%= bootstrap_form_for Spotlight::Engine.user_class.new, html: { class: 'admin-users' }, url: spotlight.admin_users_path do |f| %>
3
3
  <div class="mb-4">
4
4
  <h3 class="instructions"><%= t :'.instructions' %></h3>
@@ -71,29 +71,7 @@
71
71
  <div class="card-group dd main_navigation_admin col-sm-7" id="nested-navigation" data-behavior="nestable" data-max-depth="1">
72
72
  <ol class="dd-list">
73
73
  <%= f.fields_for :main_navigations do |label| %>
74
- <li class="dd-item dd3-item" data-id="<%= label.object.id %>">
75
- <div class="card d-flex dd3-content">
76
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
77
- <div class="card-body d-flex" data-behavior="restore-default">
78
- <%= label.hidden_field :id %>
79
- <div class="flex-grow-1 py-2">
80
- <h3 class="card-title h6 mb-0">
81
- <span class='publish-control h6'>
82
- <%= label.check_box_without_bootstrap :display %>
83
- </span>
84
- <span class="d-inline-block w-75" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
85
- <a href="#edit-in-place" class="field-label edit-in-place"><%= label.object.label_or_default %></a>
86
- <%= label.hidden_field :label, data: {:"default-value" => label.object.default_label, :"edit-field-target" => 'true'} %>
87
- </span>
88
- </h3>
89
- </div>
90
- <div class="">
91
- <%= button_tag t(:'.restore_default'), data: {:"restore-default" => true}, class: "btn restore-default btn-secondary btn-sm float-right #{'d-none' if label.object.label.blank? || label.object.label == label.object.default_label}" %>
92
- </div>
93
- <%= label.hidden_field :weight, data: {property: "weight"} %>
94
- </div>
95
- </div>
96
- </li>
74
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: label.object.nav_type, field: label, label: label.object.label_or_default, default_value: label.object.default_label, enabled_method: :display } do; end %>
97
75
  <% end %>
98
76
  </ol>
99
77
  </div>
@@ -5,8 +5,9 @@
5
5
  <%= image_tag(search.thumbnail_image_url || 'spotlight/default_browse_thumbnail.jpg', class: 'img-responsive', alt: '') %>
6
6
  <div class="text-overlay">
7
7
  <h2 class="browse-category-title">
8
- <%= search.title%>
9
- <small><%= t :'spotlight.browse.search.item_count', count: search.count %></small>
8
+ <span class="title"><%= search.title%></span>
9
+ <% if search.subtitle.present? %><span class="category-subtitle"><%= search.subtitle %></span><% end %>
10
+ <small class="item-count"><%= t :'spotlight.browse.search.item_count', count: search.count %></small>
10
11
  </h2>
11
12
  </div>
12
13
  </div>
@@ -1,2 +1,3 @@
1
- <%= search.title %>
1
+ <span class="title"><%= search.title %></span>
2
+ <% if search.subtitle.present? %><span class="subtitle"><%= search.subtitle %></span><% end %>
2
3
  <small class="item-count"><%= t :'spotlight.browse.search.item_count', count: params[:browse_q] ? parent_search_count: search.count %></small>
@@ -1,4 +1,4 @@
1
- <%= page_title t(:'spotlight.sites.new.section') %>
1
+ <%= page_title t(:'.page_title') %>
2
2
  <%= render 'new_exhibit_form' %>
3
3
 
4
4
  <% content_for(:sidebar_position) { 'order-last' } %>
@@ -3,11 +3,15 @@
3
3
  <% @exhibit.feature_pages.for_locale.published.at_top_level.each do |feature_section| %>
4
4
  <li class="<%= 'active' if current_page? [spotlight, @exhibit, feature_section] %>">
5
5
  <h2 class="h6"><%= link_to_unless_current feature_section.title, [spotlight, @exhibit, feature_section] %></h2>
6
- <ol class="subsection">
7
- <% feature_section.child_pages.published.each do |page| %>
8
- <li class="<%= 'active' if current_page? [spotlight, @exhibit, page] %>"><%= link_to_unless_current page.title, [spotlight, @exhibit, page] %></li>
9
- <% end %>
10
- </ol>
6
+ <% child_pages = feature_section.child_pages.published %>
7
+
8
+ <% if child_pages.any? %>
9
+ <ol class="subsection">
10
+ <% child_pages.each do |page| %>
11
+ <li class="<%= 'active' if current_page? [spotlight, @exhibit, page] %>"><%= link_to_unless_current page.title, [spotlight, @exhibit, page] %></li>
12
+ <% end %>
13
+ </ol>
14
+ <% end %>
11
15
  </li>
12
16
  <% end %>
13
17
  </ol>
@@ -1,3 +1,12 @@
1
1
  <p><%= t :".title" %></p>
2
2
 
3
3
  <p><%= t :".body", count: @number, title: @exhibit.title %></p>
4
+
5
+ <% if @errors.length > 0 %>
6
+ <p><%= t :".errors", default: :'spotlight.catalog.reindex_progress_panel.error' %></p>
7
+ <ul>
8
+ <% @errors.each do |index, message| %>
9
+ <li><%= t :'.error', index: index, message: message.to_sentence %>
10
+ <% end %>
11
+ </ul>
12
+ <% end %>
@@ -2,7 +2,7 @@
2
2
  # TODO: the "if @page.persisted?" business below could possibly be done w/ some clever polymorphic routing.
3
3
  # Leaving as-is for now since technically you can't get to the new page form anyway.
4
4
  %>
5
- <%= bootstrap_form_for([spotlight, @page.exhibit, @page], role: 'form', html: { data: configurations_for_current_page.merge('form-observer': true)}) do |f| %>
5
+ <%= bootstrap_form_for(@page, url: url_for([spotlight, @page.exhibit, @page, format: nil]), role: 'form', html: { data: configurations_for_current_page.merge('form-observer': true)}) do |f| %>
6
6
  <%= render @page.lock if @page.lock and not @page.lock.stale? and not @page.lock.current_session? %>
7
7
  <% if @page.errors.any? %>
8
8
  <div id="error_explanation">
@@ -40,7 +40,7 @@
40
40
  </div>
41
41
  <div class="form-group">
42
42
  <%= f.label :content, class: 'sr-only' %>
43
- <%= f.text_area_without_bootstrap :content, value: { data: f.object.content.as_json }.to_json, class: content_editor_class(f.object), data: { 'block-types': Spotlight::Engine.config.sir_trevor_widgets } %>
43
+ <%= f.text_area_without_bootstrap :content, value: { data: f.object.content.as_json }.to_json, class: content_editor_class(f.object), data: { 'block-types': SirTrevorRails::Block.custom_block_types } %>
44
44
  </div>
45
45
  </div>
46
46
 
@@ -1,40 +1,24 @@
1
1
  <% page = f.object %>
2
- <li class="dd-item dd3-item" data-id="<%= page.id %>">
3
- <div class="dd3-content card page-admin d-flex">
4
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
5
- <div class="card-body page d-flex justify-content-between">
6
- <div class="flex-grow-1">
7
- <%= f.hidden_field :id %>
8
- <%= f.hidden_field :weight, data: {property: "weight"} %>
9
- <h3 class="h6 card-title">
10
- <span class="publish-control">
11
- <%= f.check_box :published, inline: true, hide_label: true %>
12
- </span>
13
- <span class="d-inline-block w-75" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
14
- <a href="#edit-in-place" class="field-label edit-in-place"><%= page.title %></a>
15
- <%= f.hidden_field :title, value: page.title , class: 'form-control form-control-sm title-field', data: {:"edit-field-target" => 'true'} %>
16
- </span>
17
- </h3>
18
- </div>
19
-
20
- <div class="page-links">
21
- <%= exhibit_view_link page %> &middot;
22
- <%= exhibit_edit_link page, data: { turbolinks: false } %> &middot;
23
- <%= exhibit_delete_link page %>
24
- </div>
25
- <%- if page.feature_page? -%>
26
- <%= f.hidden_field :parent_page_id, data: {property: "parent_page"} %>
27
- <% end %>
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| %>
3
+ <% case section when :additional_options %>
4
+ <div class="page-links">
5
+ <%= exhibit_view_link page %> &middot;
6
+ <%= exhibit_edit_link page, data: { turbolinks: false } %> &middot;
7
+ <%= exhibit_delete_link page %>
28
8
  </div>
29
- </div>
30
-
31
- <% if page.feature_page? and page.child_pages.present? %>
32
- <ol class="dd-list">
33
- <% page.child_pages.each do |child_page| %>
34
- <%= parent_form.fields_for page_collection_name, child_page do |p| %>
35
- <%= render partial: 'page', locals: {f: p, parent_form: parent_form} %>
9
+ <%- if page.feature_page? -%>
10
+ <%= f.hidden_field :parent_page_id, data: {property: "parent_page"} %>
11
+ <% end %>
12
+ <% when :nested_components %>
13
+ <% if page.feature_page? and page.child_pages.present? %>
14
+ <ol class="dd-list">
15
+ <% page.child_pages.each do |child_page| %>
16
+ <%= parent_form.fields_for page_collection_name, child_page do |p| %>
17
+ <%= render partial: 'page', locals: {f: p, parent_form: parent_form} %>
18
+ <% end %>
36
19
  <% end %>
37
- <% end %>
38
- </ol>
20
+ </ol>
21
+ <% end %>
39
22
  <% end %>
23
+ <% end %>
40
24
  </li>
@@ -5,43 +5,24 @@
5
5
  <% @blacklight_configuration.blacklight_config.facet_fields.select { |k, v| blacklight_configuration_context.evaluate_if_unless_configuration(v.original) }.each do |key, config| %>
6
6
  <% metadata = @field_metadata.field(key) %>
7
7
  <% next unless metadata[:document_count] > 0 || config.custom_field %>
8
- <li class="dd-item" data-id="<%= key.parameterize %>">
9
- <%= idxf.fields_for key do |facet| %>
10
- <div class="dd3-content facet-config-<%= key.parameterize %> page card d-flex">
11
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
12
- <div class="card-header d-flex">
13
- <div class="flex-grow-1">
14
- <h3 class="h6 card-title">
15
- <%= facet.hidden_field :weight, 'data-property' => 'weight' %>
16
- <%= facet.check_box :show, inline: true, checked: config.show, hide_label: true, title: key %>
17
- <span class="d-inline-block w-75" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
18
- <a href="#edit-in-place" class="field-label edit-in-place"><%= facet_field_label(key) %></a>
19
- <%= facet.hidden_field :label, value: facet_field_label(key), class: 'form-control form-control-sm', data: {:"edit-field-target" => 'true'} %>
20
- </span>
21
- </h3>
22
- </div>
23
- <div class="d-flex">
24
- <div class="facet-metadata mr-3">
25
- <%= render partial: 'facet_metadata', locals: { metadata: metadata } %>
26
- </div>
27
- <div class="">
28
- <button class="btn btn-link collapse-toggle collapsed" type="button" data-toggle="collapse" data-target="#<%= key.parameterize %>_facet_options" aria-expanded="false" aria-controls="<%= key.parameterize %>_facet_options">
29
- Options
30
- </button>
31
- <span class="collapse-chevron">❯</span>
32
- </div>
33
- </div>
34
- </div>
35
- <div id="<%= key.parameterize %>_facet_options" class="options collapse mt-2">
36
- <%= facet.form_group :terms, label_col: 'col-md-2 offset-md-1', label: { text: t(:'.sort_by.label') } do %>
37
- <%= facet.radio_button :sort, 'count', label: t(:'.sort_by.count'), checked: (config.sort.to_s == 'count' || config.sort.nil?) %>
38
- <%= facet.radio_button :sort, 'index', label: t(:'.sort_by.index'), checked: (config.sort.to_s == 'index') %>
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| %>
10
+ <% case section when :additional_content %>
11
+ <div class="mt-2">
12
+ <%= facet.form_group :terms, label_col: 'col-md-2 offset-md-1', label: { text: t(:'spotlight.search_configurations.facets.sort_by.label') } do %>
13
+ <%= facet.radio_button :sort, 'count', label: t(:'spotlight.search_configurations.facets.sort_by.count'), checked: (config.sort.to_s == 'count' || config.sort.nil?) %>
14
+ <%= facet.radio_button :sort, 'index', label: t(:'spotlight.search_configurations.facets.sort_by.index'), checked: (config.sort.to_s == 'index') %>
39
15
  <% end %>
40
16
  </div>
41
- </div>
17
+ <% when :additional_options %>
18
+ <div class="facet-metadata mr-3">
19
+ <%= render partial: 'facet_metadata', locals: { metadata: metadata } %>
20
+ </div>
21
+ <% else %>
22
+ <% end %>
42
23
  <% end %>
43
- </li>
44
- <% end %>
24
+ <% end %>
25
+ <% end %>
45
26
  <% end %>
46
27
  </ol>
47
28
  </div>
@@ -31,25 +31,10 @@
31
31
  <div class="panel-group dd search_fields_admin col-sm-7" id="nested-search-fields" data-behavior="nestable" data-max-depth="1">
32
32
  <ol class="dd-list">
33
33
  <% @blacklight_configuration.blacklight_config.search_fields.select { |_k, v| blacklight_configuration_context.evaluate_if_unless_configuration(v.original) && v.include_in_simple_select != false }.except(default_field.key).each_with_index do |(k, config), index| %>
34
- <li class="dd-item dd3-item" data-id="<%= k.parameterize %>-id">
35
- <div class="card d-flex dd3-content">
36
- <div class="dd-handle dd3-handle"><%= t(:drag) %></div>
37
- <div class="card-header d-flex" data-behavior="restore-default">
38
- <div class="flex-grow-1">
39
- <h3 class="h6 card-title">
40
- <%= vt.fields_for k, config do |field| %>
41
- <%= field.hidden_field :weight, value: index, data: {property: "weight"} %>
42
- <%= field.check_box :enabled, inline: true, checked: config.enabled, hide_label: true, title: k %>
43
- <span class="d-inline-block w-75" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
44
- <a href="#edit-in-place" class="field-label edit-in-place"><%= config.label %></a>
45
- <%= field.hidden_field :label, class: 'form-control form-control-sm', data: {:"edit-field-target" => "true"} %>
46
- </span>
47
- <% end %>
48
- </h3>
49
- </div>
50
- </div>
51
- </div>
52
- </li>
34
+ <%= vt.fields_for k, config do |field| %>
35
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: k, index: index, field: field } do %>
36
+ <% end %>
37
+ <% end %>
53
38
  <% end %>
54
39
  </ol>
55
40
  </div>
@@ -28,28 +28,14 @@
28
28
  <div class="panel-group dd sort_fields_admin col-10" id="nested-sort-fields" data-behavior="nestable" data-max-depth="1">
29
29
  <ol class="dd-list">
30
30
  <% @blacklight_configuration.blacklight_config.sort_fields.select { |k, v| blacklight_configuration_context.evaluate_if_unless_configuration(v.original) }.except(default_field.key).each_with_index do |(k, config), index| %>
31
- <li class="dd-item dd3-item" data-id="<%= k.parameterize %>-id">
32
- <div class="card d-flex dd3-content">
33
- <div class="dd-handle dd3-handle"><%= t(:drag) %></div>
34
- <div class="card-header d-flex" data-behavior="restore-default">
35
- <div class="flex-grow-1">
36
- <h3 class="h6 card-title">
37
- <%= vt.fields_for k, config do |field| %>
38
- <%= field.hidden_field :weight, value: index, data: {property: "weight"} %>
39
- <%= field.check_box :enabled, inline: true, checked: config.enabled, hide_label: true, title: k %>
40
- <span class="d-inline-block w-75" data-in-place-edit-target=".edit-in-place" data-in-place-edit-field-target="[data-edit-field-target='true']">
41
- <a href="#edit-in-place" class="field-label edit-in-place"><%= config.label %></a>
42
- <%= field.hidden_field :label, class: 'form-control form-control-sm', data: {:"edit-field-target" => "true"} %>
43
- </span>
44
- <% end %>
45
- </h3>
46
- </div>
47
- </div>
48
- <div class="card-body bg-white">
49
- <p class="card-text"><%= translate_sort_fields(config) %></p>
50
- </div>
51
- </div>
52
- </li>
31
+
32
+ <%= vt.fields_for k, config do |field| %>
33
+ <%= render layout: 'spotlight/shared/dd3_item', locals: { id: k, index: index, field: field, card_data: { behavior: 'restore-default' }, label: config.label } do |_, section| %>
34
+ <% case section when :card_body %>
35
+ <p class="card-text"><%= translate_sort_fields(config) %></p>
36
+ <% end %>
37
+ <% end %>
38
+ <% end %>
53
39
  <% end %>
54
40
  </ol>
55
41
  </div>
@@ -29,6 +29,7 @@
29
29
  <div class="tab-content">
30
30
  <div role="tabpanel" class="tab-pane active" id="search-description">
31
31
  <%= f.text_field :title, control_col: "col-sm-5" %>
32
+ <%= f.text_field :subtitle, control_col: "col-sm-5" %>
32
33
  <%= f.text_area :long_description, rows: 5 %>
33
34
  <%= f.form_group :search_box, label: { text: t(:'.search_box.label'), class: 'pt-0' }, help: t(:'.search_box.help_block') do %>
34
35
  <%= f.check_box :search_box, label: t(:'.search_box.checkbox_label') %>
@@ -1,36 +1,38 @@
1
1
  <% search = f.object %>
2
- <li class="dd-item dd3-item" data-id="<%= search.id %>">
3
- <div class="dd3-content card">
4
- <div class="search d-flex card-body">
5
- <div>
6
- <%= f.check_box :published, inline: true, hide_label: true %>
7
- </div>
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| %>
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
8
 
9
- <div class="pic">
10
- <%= image_tag(search.thumbnail_image_url || 'spotlight/default_browse_thumbnail.jpg', class: 'img-thumbnail') %>
11
- </div>
9
+ <div class="pic">
10
+ <%= image_tag(search.thumbnail_image_url || 'spotlight/default_browse_thumbnail.jpg', class: 'img-thumbnail') %>
11
+ </div>
12
12
 
13
- <div class="flex-grow-1 mx-2 main">
14
- <h4 class="card-title h6 mb-0">
15
- <%= search.title %>
16
- </h4>
13
+ <div class="flex-grow-1 mx-2 main">
14
+ <h4 class="card-title h6 mb-0">
15
+ <%= search.title %>
16
+ <% if search.subtitle.present? %><span class="subtitle"><%= search.subtitle %></span><% end %>
17
+ </h4>
17
18
 
18
- <div class="card-text">
19
- <div class="count"><%= t :'.item_count', count: search.count %></div>
20
- <div class="actions"><%= exhibit_view_link(search) %> &bull; <%= exhibit_edit_link(search) %> &bull; <%= exhibit_delete_link(search) %></div>
21
- <%= f.hidden_field :id %>
22
- <%= f.hidden_field :weight, data: {property: "weight"} %>
23
- </div>
19
+ <div class="card-text">
20
+ <div class="count"><%= t :'spotlight.searches.search.item_count', count: search.count %></div>
21
+ <div class="actions"><%= exhibit_view_link(search) %> &bull; <%= exhibit_edit_link(search) %> &bull; <%= exhibit_delete_link(search) %></div>
22
+ <%= f.hidden_field :id %>
23
+ <%= f.hidden_field :weight, data: {property: "weight"} %>
24
24
  </div>
25
- <div class="flex-grow-1 mx-2 description">
26
- <div class="card-text">
27
- <% if search.long_description.present? %>
28
- <%= truncate(search.long_description, length: 89) %>
29
- <% else %>
30
- <span class="missing-description"><%= t(:'.missing_description_html', link: (link_to action_label(search, :edit_long), [spotlight, :edit, search.exhibit, search])) %></span>
31
- <% end %>
32
- </div>
25
+ </div>
26
+ <% when :additional_options %>
27
+ <div class="flex-grow-1 mx-2 description">
28
+ <div class="card-text">
29
+ <% if search.long_description.present? %>
30
+ <%= truncate(search.long_description, length: 89) %>
31
+ <% else %>
32
+ <span class="missing-description"><%= t(:'spotlight.searches.search.missing_description_html', link: (link_to action_label(search, :edit_long), [spotlight, :edit, search.exhibit, search])) %></span>
33
+ <% end %>
33
34
  </div>
34
35
  </div>
35
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
36
- </li>
36
+ <% else %>
37
+ <% end %>
38
+ <% end %>