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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spotlight/_accessibility.scss +8 -0
  3. data/app/assets/stylesheets/spotlight/_curation.scss +3 -16
  4. data/app/assets/stylesheets/spotlight/_nestable.scss +4 -0
  5. data/app/assets/stylesheets/spotlight/_pages.scss +3 -1
  6. data/app/assets/stylesheets/spotlight/_spotlight.scss +1 -0
  7. data/app/controllers/concerns/spotlight/base.rb +8 -0
  8. data/app/controllers/spotlight/catalog_controller.rb +2 -2
  9. data/app/controllers/spotlight/pages_controller.rb +0 -4
  10. data/app/models/spotlight/page.rb +2 -2
  11. data/app/views/layouts/spotlight/spotlight.html.erb +1 -1
  12. data/app/views/spotlight/about_pages/_contact.html.erb +15 -17
  13. data/app/views/spotlight/appearances/edit.html.erb +1 -23
  14. data/app/views/spotlight/feature_pages/_sidebar.html.erb +9 -5
  15. data/app/views/spotlight/pages/_page.html.erb +19 -35
  16. data/app/views/spotlight/search_configurations/_facets.html.erb +15 -34
  17. data/app/views/spotlight/search_configurations/_search_fields.html.erb +4 -19
  18. data/app/views/spotlight/search_configurations/_sort.html.erb +8 -22
  19. data/app/views/spotlight/searches/_search.html.erb +30 -29
  20. data/app/views/spotlight/shared/_dd3_item.html.erb +56 -0
  21. data/config/locales/spotlight.en.yml +2 -1
  22. data/lib/spotlight/engine.rb +3 -0
  23. data/lib/spotlight/version.rb +1 -1
  24. data/spec/models/spotlight/feature_page_spec.rb +0 -5
  25. data/spec/views/spotlight/feature_pages/_sidebar.html.erb_spec.rb +1 -0
  26. data/spec/views/spotlight/search_configurations/_search_fields.html.erb_spec.rb +1 -1
  27. data/spec/views/spotlight/search_configurations/_sort.html.erb_spec.rb +2 -2
  28. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8148cceceb619e368c4bffa31b5e42d16bf32e0949b617f0d7214a9deb4e7101
4
- data.tar.gz: daa2ff322a5344f0cdd20a3dc2df65f8e0322d2c52dea293ea7182e082a46de5
3
+ metadata.gz: 61d1cc793dd74339242e08e5a0c66ba33ebde6736f25423fa6315bc52ae7fcbf
4
+ data.tar.gz: 00a54261d57877c5610e244851d82d32b0700c01cb919af5d2ac17481d5e7de9
5
5
  SHA512:
6
- metadata.gz: 2f7c4277f47edbcfa9b4981e509ad96869c6b4724ed18ecf961c9ba4541b0abd6ecb341871db52cbd492bb12601360d89a7a1e067b589de25d510ccf946520f6
7
- data.tar.gz: 8d707819d16753591acd7f43bd863876e2df5d95a6434a2ca9ec67fe09da58767cb74a137cdc183ff80f77d615e88afc688d711b7f1235f1a6ffa47e61f28e3b
6
+ metadata.gz: 50cba1c7d20e658be91c54ff2c56f9c296b9b521df5d1054e202d6eba74d6f3dbd67dfeec7701e4061e2db0f26e66e0241e3494adea2002280ad68a787a06d2b
7
+ data.tar.gz: cd32bcc19cfa68295fcc40b2969e47a0623dbe750e3bcb4e3d2fb86b3825f7897a10da3ba87fd4ef3b5f855bb1f7ce875fbca16c12087a53456ca40120a4f0e3
@@ -0,0 +1,8 @@
1
+ // Global accessibility overrides
2
+
3
+ // Increase visibility of Firefox focus indicator
4
+ @-moz-document url-prefix() {
5
+ &:focus {
6
+ outline: $input-focus-border-color auto 5px;
7
+ }
8
+ }
@@ -38,23 +38,10 @@
38
38
  display: inline-block;
39
39
  margin-bottom: 0;
40
40
  }
41
- .checkbox {
42
- width: 3%;
43
- vertical-align: top;
44
- display: inline-block;
45
- padding-top: 0;
46
- }
47
-
48
- .publish-control {
49
- display: inline;
50
41
 
51
- .checkbox {
52
- padding-top: 0;
53
- }
54
-
55
- .form-check-inline {
56
- vertical-align: middle;
57
- }
42
+ .form-check-inline {
43
+ margin-top: -3px;
44
+ vertical-align: middle;
58
45
  }
59
46
 
60
47
  .main {
@@ -85,6 +85,10 @@ tr.dd-item {
85
85
  &.card, .card {
86
86
  padding: 0 0 0 30px;
87
87
  }
88
+
89
+ .card-header[data-behavior="restore-default"] {
90
+ min-height: 3rem;
91
+ }
88
92
  }
89
93
  .dd3-content.page-admin {
90
94
  position: relative;
@@ -80,6 +80,7 @@
80
80
  }
81
81
 
82
82
  ol.subsection {
83
+ margin-bottom: $spacer;
83
84
  padding-left: 0;
84
85
  li {
85
86
  list-style: square;
@@ -98,9 +99,10 @@
98
99
  .contact-photo {
99
100
  border: 1px solid #ccc;
100
101
  border-radius: $border-radius;
102
+ height: 70px;
101
103
  margin-right: 15px;
102
104
  margin-top: 3px;
103
- max-height: 70px;
105
+ width: 70px;
104
106
  }
105
107
 
106
108
  // Indent contact fields so they align evenly, only when there is a contact photo
@@ -31,6 +31,7 @@
31
31
  @import "spotlight/collapse_toggle";
32
32
  @import "spotlight/translations";
33
33
  @import "spotlight/utilities";
34
+ @import "spotlight/accessibility";
34
35
 
35
36
 
36
37
 
@@ -9,6 +9,14 @@ module Spotlight
9
9
  include Blacklight::Base
10
10
  include Spotlight::Config
11
11
 
12
+ included do
13
+ helper_method :controller_tracking_method
14
+ end
15
+
16
+ def controller_tracking_method
17
+ Spotlight::Engine.config.controller_tracking_method
18
+ end
19
+
12
20
  # This overwrites Blacklight::Configurable#blacklight_config
13
21
  def blacklight_config
14
22
  exhibit_specific_blacklight_config
@@ -209,9 +209,9 @@ module Spotlight
209
209
  if current_browse_category
210
210
  add_breadcrumb current_browse_category.exhibit.main_navigations.browse.label_or_default, exhibit_browse_index_path(current_browse_category.exhibit)
211
211
  add_breadcrumb current_browse_category.title, exhibit_browse_path(current_browse_category.exhibit, current_browse_category)
212
- elsif current_page_context && current_page_context.title.present? && !current_page_context.is_a?(Spotlight::HomePage)
212
+ elsif current_page_context&.title&.present? && !current_page_context.is_a?(Spotlight::HomePage)
213
213
  add_breadcrumb current_page_context.title, [current_page_context.exhibit, current_page_context]
214
- elsif current_search_session
214
+ elsif current_search_session && !current_page_context&.is_a?(Spotlight::HomePage)
215
215
  add_breadcrumb t(:'spotlight.catalog.breadcrumb.index'), search_action_url(current_search_session.query_params)
216
216
  end
217
217
 
@@ -19,10 +19,6 @@ module Spotlight
19
19
 
20
20
  helper_method :get_search_results, :search_results, :fetch, :page_collection_name, :presenter
21
21
 
22
- before_action do
23
- blacklight_config.track_search_session = false
24
- end
25
-
26
22
  # GET /exhibits/1/pages
27
23
  def index
28
24
  # set up a model the inline "add a new page" form
@@ -4,7 +4,7 @@ module Spotlight
4
4
  ##
5
5
  # Base page class. See {Spotlight::AboutPage}, {Spotlight::FeaturePage}, {Spotlight::HomePage}
6
6
  class Page < ActiveRecord::Base
7
- MAX_PAGES = 1000
7
+ MAX_PAGES = Spotlight::Engine.config.max_pages
8
8
 
9
9
  extend FriendlyId
10
10
  friendly_id :title, use: %i[slugged scoped finders history], scope: %i[exhibit locale]
@@ -21,7 +21,7 @@ module Spotlight
21
21
  dependent: :destroy,
22
22
  inverse_of: :default_locale_page
23
23
 
24
- validates :weight, inclusion: { in: proc { 0..Spotlight::Page::MAX_PAGES } }
24
+ validates :weight, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: Spotlight::Page::MAX_PAGES }
25
25
 
26
26
  default_scope { order('weight ASC') }
27
27
  scope :at_top_level, -> { where(parent_page_id: nil) }
@@ -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 %>
@@ -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 %>
@@ -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>
@@ -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,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>
@@ -1,36 +1,37 @@
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
+ </h4>
17
17
 
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>
18
+ <div class="card-text">
19
+ <div class="count"><%= t :'spotlight.searches.search.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"} %>
24
23
  </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>
24
+ </div>
25
+ <% when :additional_options %>
26
+ <div class="flex-grow-1 mx-2 description">
27
+ <div class="card-text">
28
+ <% if search.long_description.present? %>
29
+ <%= truncate(search.long_description, length: 89) %>
30
+ <% else %>
31
+ <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>
32
+ <% end %>
33
33
  </div>
34
34
  </div>
35
- <div class="dd-handle dd3-handle"><%= t :drag %></div>
36
- </li>
35
+ <% else %>
36
+ <% end %>
37
+ <% end %>
@@ -0,0 +1,56 @@
1
+ <% main_content = yield %>
2
+ <% additional_options = yield nil, :additional_options %>
3
+ <% additional_content = yield nil, :additional_content %>
4
+ <% card_body = yield nil, :card_body %>
5
+ <% dd3_content_classes = local_assigns[:dd3_content_classes].presence %>
6
+ <% card_data = local_assigns[:card_data].presence || {} %>
7
+ <% enabled_method = local_assigns[:enabled_method].presence || :enabled %>
8
+ <% label_method = local_assigns[:label_method].presence || :label %>
9
+ <% label = local_assigns[:label].presence || field.object.public_send(label_method) %>
10
+ <% default_value = local_assigns[:default_value].presence %>
11
+ <% index = local_assigns[:index].presence %>
12
+ <% card_data[:behavior] ||= 'restore-default' if default_value %>
13
+
14
+ <li class="dd-item" data-id="<%= id.parameterize %>">
15
+ <div class="dd3-content <%= dd3_content_classes %> card d-flex">
16
+ <div class="dd-handle dd3-handle"><%= t :drag %></div>
17
+ <%= content_tag :div, class: "d-flex card-header", data: card_data do %>
18
+ <%= field.hidden_field :id %>
19
+ <% if main_content.present? %>
20
+ <%= main_content %>
21
+ <% else %>
22
+ <div class="flex-grow-1 align-self-center">
23
+ <h3 class="h6 card-title mb-0">
24
+ <%= field.hidden_field :weight, value: index, 'data-property' => 'weight' %>
25
+ <%= field.check_box enabled_method, inline: true, checked: field.object.public_send(enabled_method), hide_label: true, title: label %>
26
+ <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']">
27
+ <a href="#edit-in-place" class="field-label edit-in-place"><%= label %></a>
28
+ <%= field.hidden_field label_method, value: label, class: 'form-control form-control-sm title-field', data: {:"edit-field-target" => 'true', default_value: default_value } %>
29
+ </span>
30
+ </h3>
31
+ </div>
32
+ <% end %>
33
+
34
+ <% if default_value %>
35
+ <div class="">
36
+ <%= button_tag t(:'.restore_default'), data: {:"restore-default" => true}, class: "btn restore-default btn-secondary btn-sm #{'d-none' if label.blank? || label == default_value}" %>
37
+ </div>
38
+ <% end %>
39
+
40
+ <%= content_tag :div, additional_options, class: 'd-flex' if additional_options.present? %>
41
+
42
+
43
+ <% if additional_content.present? %>
44
+ <div class="d-flex">
45
+ <button class="btn btn-link collapse-toggle collapsed" type="button" data-toggle="collapse" data-target="#<%= id.parameterize %>_options" aria-expanded="false" aria-controls="<%= id.parameterize %>_options">
46
+ Options
47
+ </button>
48
+ <span class="collapse-chevron">❯</span>
49
+ </div>
50
+ <% end %>
51
+ <% end %>
52
+ <%= content_tag :div, additional_content, id: "#{id.parameterize}_options", class: 'options collapse' if additional_content.present? %>
53
+ <%= content_tag :div, card_body, class: 'card-body bg-white' if card_body.present? %>
54
+ </div>
55
+ <%= yield nil, :nested_components %>
56
+ </li>
@@ -195,7 +195,6 @@ en:
195
195
  main_navigation:
196
196
  help: Select the menu items you want to be displayed in the main navigation menu (menu items are only displayed when published pages exist for that item). Click a menu item to change its display label. Drag and drop a menu item to change their order in the menu.
197
197
  menu: Main menu
198
- restore_default: Restore default
199
198
  site_masthead:
200
199
  heading: Exhibit masthead
201
200
  help: You can select and crop an image to use as a background in your exhibit site's masthead. To use an image as a masthead background, 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.
@@ -766,6 +765,8 @@ en:
766
765
  other: "%{count} items"
767
766
  missing_description_html: "%{link} to add a description."
768
767
  shared:
768
+ dd3_item:
769
+ restore_default: Restore default
769
770
  exhibit_sidebar:
770
771
  header: Administration menu
771
772
  report_a_problem:
@@ -192,6 +192,7 @@ module Spotlight
192
192
  config.ga_analytics_options = {}
193
193
  config.ga_page_analytics_options = config.ga_analytics_options.merge(limit: 5)
194
194
  config.ga_anonymize_ip = false # false for backwards compatibility
195
+ config.max_pages = 1000
195
196
 
196
197
  Blacklight::Engine.config.inject_blacklight_helpers = false
197
198
 
@@ -251,6 +252,8 @@ module Spotlight
251
252
  config.routes = OpenStruct.new
252
253
  config.routes.solr_documents = {}
253
254
 
255
+ config.controller_tracking_method = 'track_catalog_path'
256
+
254
257
  config.exports = {
255
258
  attachments: true,
256
259
  blacklight_configuration: true,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Spotlight
4
- VERSION = '3.0.0.alpha.6'
4
+ VERSION = '3.0.0.alpha.7'
5
5
  end
@@ -57,11 +57,6 @@ describe Spotlight::FeaturePage, type: :model do
57
57
  expect(low_weight).not_to be_valid
58
58
  expect(high_weight).not_to be_valid
59
59
  end
60
-
61
- it 'settable valid maximum' do
62
- stub_const('Spotlight::Page::MAX_PAGES', 2000)
63
- expect(high_weight).to be_valid
64
- end
65
60
  end
66
61
 
67
62
  it { is_expected.to be_feature_page }
@@ -34,6 +34,7 @@ describe 'spotlight/feature_pages/_sidebar.html.erb', type: :view do
34
34
  assign(:page, child1)
35
35
  render
36
36
  # Checking that they are sorted accoding to weight
37
+ expect(rendered).to have_selector 'ol.sidenav', count: 1
37
38
  expect(rendered).to have_selector 'li', text: 'Parent Page'
38
39
  expect(rendered).to have_selector 'ol.sidenav li:nth-child(1) a', text: 'Five'
39
40
  expect(rendered).to have_selector 'ol.sidenav li:nth-child(2) a', text: 'Three'
@@ -49,6 +49,6 @@ describe 'spotlight/search_configurations/_search_fields', type: :view do
49
49
  end
50
50
 
51
51
  it 'parameterizes the data-id attribute for search field key' do
52
- expect(rendered).to have_selector '[data-id="some_field-with_a_space-id"]'
52
+ expect(rendered).to have_selector '[data-id="some_field-with_a_space"]'
53
53
  end
54
54
  end
@@ -31,11 +31,11 @@ describe 'spotlight/search_configurations/_sort', type: :view do
31
31
 
32
32
  it 'parameterizes the data-id attribute for sort fields (e.g. when no key is supplied and the sort is used as the key)' do
33
33
  render partial: 'spotlight/search_configurations/sort', locals: { f: f }
34
- expect(rendered).to have_css('[data-id="sort_title_ssi-asc-plus_another_field-desc-id"]')
34
+ expect(rendered).to have_css('[data-id="sort_title_ssi-asc-plus_another_field-desc"]')
35
35
  end
36
36
 
37
37
  it 'hides fields that are configured not to display' do
38
38
  render partial: 'spotlight/search_configurations/sort', locals: { f: f }
39
- expect(rendered).not_to have_css('[data-id="some_disabled_field-id"]')
39
+ expect(rendered).not_to have_css('[data-id="some_disabled_field"]')
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.alpha.6
4
+ version: 3.0.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-02-26 00:00:00.000000000 Z
14
+ date: 2020-03-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: acts-as-taggable-on
@@ -844,6 +844,7 @@ files:
844
844
  - app/assets/javascripts/spotlight/user/index.js
845
845
  - app/assets/javascripts/spotlight/user/report_a_problem.js
846
846
  - app/assets/javascripts/spotlight/user/zpr_links.js.erb
847
+ - app/assets/stylesheets/spotlight/_accessibility.scss
847
848
  - app/assets/stylesheets/spotlight/_attachments.css
848
849
  - app/assets/stylesheets/spotlight/_blacklight_configuration.scss
849
850
  - app/assets/stylesheets/spotlight/_blacklight_overrides.scss
@@ -1174,6 +1175,7 @@ files:
1174
1175
  - app/views/spotlight/searches/index.html.erb
1175
1176
  - app/views/spotlight/shared/_configuration_sidebar.html.erb
1176
1177
  - app/views/spotlight/shared/_curation_sidebar.html.erb
1178
+ - app/views/spotlight/shared/_dd3_item.html.erb
1177
1179
  - app/views/spotlight/shared/_exhibit_sidebar.html.erb
1178
1180
  - app/views/spotlight/shared/_locale_picker.html.erb
1179
1181
  - app/views/spotlight/shared/_report_a_problem.html.erb