blacklight-spotlight 4.0.3 → 4.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/spotlight/_catalog.scss +0 -12
  3. data/app/assets/stylesheets/spotlight/_header.scss +9 -0
  4. data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +4 -4
  5. data/app/components/blacklight/icons/arrow_alt_circle_left_component.rb +15 -0
  6. data/app/components/blacklight/icons/arrow_alt_circle_right_component.rb +15 -0
  7. data/app/components/blacklight/icons/arrow_back_ios_component.rb +15 -0
  8. data/app/components/blacklight/icons/arrow_forward_ios_component.rb +15 -0
  9. data/app/components/blacklight/icons/check_circle_component.rb +15 -0
  10. data/app/components/blacklight/icons/check_component.rb +15 -0
  11. data/app/components/blacklight/icons/chevron_right_component.rb +15 -0
  12. data/app/components/blacklight/icons/close_component.rb +15 -0
  13. data/app/components/blacklight/icons/edit_component.rb +15 -0
  14. data/app/components/blacklight/icons/error_component.rb +14 -0
  15. data/app/components/blacklight/icons/highlight_off_component.rb +15 -0
  16. data/app/components/blacklight/icons/info_component.rb +15 -0
  17. data/app/components/blacklight/icons/warning_component.rb +14 -0
  18. data/app/components/blacklight/icons/zoom_in_component.rb +15 -0
  19. data/app/components/blacklight/icons/zoom_out_component.rb +15 -0
  20. data/app/components/spotlight/analytics/aggregation_component.html.erb +14 -0
  21. data/app/components/spotlight/analytics/aggregation_component.rb +37 -0
  22. data/app/components/spotlight/analytics/dashboard_component.html.erb +50 -0
  23. data/app/components/spotlight/analytics/dashboard_component.rb +32 -0
  24. data/app/components/spotlight/document_admin_table_component.html.erb +36 -0
  25. data/app/components/spotlight/document_admin_table_component.rb +23 -0
  26. data/app/components/spotlight/header_component.html.erb +1 -0
  27. data/app/components/spotlight/header_component.rb +6 -0
  28. data/app/components/spotlight/icon_component.rb +13 -0
  29. data/app/components/spotlight/solr_document_legacy_embed_component.html.erb +11 -0
  30. data/app/components/spotlight/solr_document_legacy_embed_component.rb +7 -0
  31. data/app/controllers/concerns/spotlight/controller.rb +1 -1
  32. data/app/controllers/spotlight/browse_controller.rb +2 -0
  33. data/app/controllers/spotlight/catalog_controller.rb +6 -2
  34. data/app/controllers/spotlight/dashboards_controller.rb +4 -3
  35. data/app/models/concerns/spotlight/exhibit_analytics.rb +6 -4
  36. data/app/models/spotlight/analytics/ga.rb +90 -43
  37. data/app/models/spotlight/blacklight_configuration.rb +8 -1
  38. data/app/views/layouts/spotlight/base.html.erb +2 -2
  39. data/app/views/shared/_header_navbar.html.erb +6 -12
  40. data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -0
  41. data/app/views/spotlight/catalog/_admin_thumbnail_default.html.erb +1 -0
  42. data/app/views/spotlight/catalog/_document_admin_table.html.erb +8 -1
  43. data/app/views/spotlight/catalog/_document_row.html.erb +2 -5
  44. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -0
  45. data/app/views/spotlight/catalog/edit.html.erb +15 -2
  46. data/app/views/spotlight/dashboards/analytics.html.erb +2 -2
  47. data/app/views/spotlight/pages/_view_type_group.html.erb +2 -5
  48. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +2 -2
  49. data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +8 -0
  50. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +3 -3
  51. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
  52. data/config/locales/spotlight.en.yml +16 -4
  53. data/lib/generators/spotlight/templates/catalog_controller.rb +3 -0
  54. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +16 -12
  55. data/lib/spotlight/engine.rb +11 -9
  56. data/lib/spotlight/version.rb +1 -1
  57. data/lib/spotlight.rb +3 -0
  58. data/spec/support/features/test_features_helpers.rb +1 -1
  59. metadata +61 -31
  60. data/app/assets/images/blacklight/arrow-alt-circle-left.svg +0 -1
  61. data/app/assets/images/blacklight/arrow-alt-circle-right.svg +0 -1
  62. data/app/assets/images/blacklight/arrow_back_ios.svg +0 -1
  63. data/app/assets/images/blacklight/arrow_forward_ios.svg +0 -1
  64. data/app/assets/images/blacklight/check.svg +0 -1
  65. data/app/assets/images/blacklight/check_circle.svg +0 -1
  66. data/app/assets/images/blacklight/chevron_right.svg +0 -1
  67. data/app/assets/images/blacklight/close.svg +0 -1
  68. data/app/assets/images/blacklight/edit.svg +0 -1
  69. data/app/assets/images/blacklight/error.svg +0 -1
  70. data/app/assets/images/blacklight/highlight_off.svg +0 -1
  71. data/app/assets/images/blacklight/info.svg +0 -1
  72. data/app/assets/images/blacklight/warning.svg +0 -1
  73. data/app/assets/images/blacklight/zoom_in.svg +0 -1
  74. data/app/assets/images/blacklight/zoom_out.svg +0 -1
  75. data/app/models/spotlight/analytics/ga_model.rb +0 -29
  76. data/app/views/spotlight/dashboards/_analytics.html.erb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32f18f140c36b39b7bca19c58d24166cddfaf1207a96463b4e9056717f5d4bc2
4
- data.tar.gz: 9bc8343e689f3bbb28e31d88717f695de88d276ff9a8209a4cf8a3258758d39b
3
+ metadata.gz: 0eb6356397553e1c11cf63f0ffea8c801d87985c9ac0cfdb953e349f85f7df86
4
+ data.tar.gz: 11c1f79ab20f53abc3616c5bb3281748fcaf6c43eedc4366021e2120ff8689f0
5
5
  SHA512:
6
- metadata.gz: ec713d378bff4ea14fb1abb60469a3306bb57195b1eaace499830e7f70714f5d8119b0e45377970615bb633184ca9a2cda883f3b65374b0a39702cb653c1015c
7
- data.tar.gz: b63cb0138dc8117ce84f19b59d074854cb74b5220551f6097b5050ccb1794c288d0f7e60ecec06228a9918c78e70cbac7916c0eda8d0cf18996a42adc85d1815
6
+ metadata.gz: 607ba81110242c6cc63bcf6215ccea19ca51d886e3ae7d62a5a720a546c222b599a2057ae5542686a3d39eb3e08212883da12cc59924a820e4030b7d990ea9b5
7
+ data.tar.gz: 37cf56a48274beae41af42e2f13ecac08644924732eeb492c8e7aa9168559605063348c8bad53e30ba5d7bf7790b02d42702210f0a9391a1c1f59156a8ac6cbf
@@ -97,14 +97,6 @@ form.edit_solr_document {
97
97
  @extend .col-md-6;
98
98
  }
99
99
 
100
- .edit_solr_document {
101
- float: right;
102
- @extend .col-md-6;
103
- border-bottom: 1px solid #ccc;
104
- margin-bottom: 1em;
105
- padding-bottom: 1em;
106
- }
107
-
108
100
  .tags, .dl-horizontal {
109
101
  @extend .col-md-6;
110
102
  }
@@ -114,10 +106,6 @@ form.edit_solr_document {
114
106
  }
115
107
  }
116
108
 
117
- .edit_solr_document {
118
- @extend .clearfix;
119
- }
120
-
121
109
  #sortAndPerPage {
122
110
  align-items: flex-end;
123
111
  }
@@ -153,3 +153,12 @@
153
153
  width: 1px;
154
154
  }
155
155
  }
156
+
157
+ #skip-link {
158
+ margin-left: 1rem;
159
+ padding-top: 0.5rem;
160
+ position: absolute;
161
+ top: 0;
162
+ z-index: 1000;
163
+ width: auto;
164
+ }
@@ -33,7 +33,7 @@
33
33
  cursor: pointer;
34
34
  }
35
35
 
36
- .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
36
+ .blacklight-icons-arrow-alt-circle-left, .blacklight-icons-arrow-alt-circle-right {
37
37
  display: inline-block;
38
38
  fill: $gray-600;
39
39
  height: 44px;
@@ -49,7 +49,7 @@
49
49
  }
50
50
 
51
51
  [aria-disabled="true"] {
52
- .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
52
+ .blacklight-icons-arrow-alt-circle-left, .blacklight-icons-arrow-alt-circle-right {
53
53
  fill: $gray-400;
54
54
 
55
55
  &:hover,&:focus {
@@ -66,7 +66,7 @@
66
66
 
67
67
  @media screen and (min-width: breakpoint-min("md")) {
68
68
  .browse-group-categories-controls {
69
- .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right {
69
+ .blacklight-icons-arrow-alt-circle-left, .blacklight-icons-arrow-alt-circle-right {
70
70
  height: 32px;
71
71
  width: 32px;
72
72
  }
@@ -81,7 +81,7 @@
81
81
  }
82
82
 
83
83
  [dir="rtl"] {
84
- .browse-group-categories-block .blacklight-icon-arrow-alt-circle-left, .blacklight-icon-arrow-alt-circle-right{
84
+ .browse-group-categories-block .blacklight-icons-arrow-alt-circle-left, .blacklight-icons-arrow-alt-circle-right{
85
85
  transform: rotate(180deg);
86
86
  }
87
87
  // Hack to override overflow issue not fixed in RTL upstream in tiny-slider
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ArrowAltCircleLeft
6
+ class ArrowAltCircleLeftComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
9
+ <!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
10
+ <path d="M256 504C119 504 8 393 8 256S119 8 256 8s248 111 248 248-111 248-248 248zm116-292H256v-70.9c0-10.7-13-16.1-20.5-8.5L121.2 247.5c-4.7 4.7-4.7 12.2 0 16.9l114.3 114.9c7.6 7.6 20.5 2.2 20.5-8.5V300h116c6.6 0 12-5.4 12-12v-64c0-6.6-5.4-12-12-12z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ArrowAltCircleRight
6
+ class ArrowAltCircleRightComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
9
+ <!-- Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->
10
+ <path d="M256 8c137 0 248 111 248 248S393 504 256 504 8 393 8 256 119 8 256 8zM140 300h116v70.9c0 10.7 13 16.1 20.5 8.5l114.3-114.9c4.7-4.7 4.7-12.2 0-16.9l-114.3-115c-7.6-7.6-20.5-2.2-20.5 8.5V212H140c-6.6 0-12 5.4-12 12v64c0 6.6 5.4 12 12 12z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ArrowBackIos
6
+ class ArrowBackIosComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path opacity=".87" fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M17.51 3.87L15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ArrowForwardIos
6
+ class ArrowForwardIosComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path opacity=".87" fill="none" d="M24 24H0V0h24v24z"/>
10
+ <path d="M6.49 20.13l1.77 1.77 9.9-9.9-9.9-9.9-1.77 1.77L14.62 12l-8.13 8.13z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for CheckCircle
6
+ class CheckCircleComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Check
6
+ class CheckComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ChevronRight
6
+ class ChevronRightComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6-6-6z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Close
6
+ class CloseComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
9
+ <path d="M0 0h24v24H0V0z" fill="none"/>
10
+ <path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Edit
6
+ class EditComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM21.41 6.34l-3.75-3.75-2.53 2.54 3.75 3.75 2.53-2.54z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Error
6
+ class ErrorComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
10
+ </svg>
11
+ SVG
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for HighlightOff
6
+ class HighlightOffComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
9
+ <path d="M0 0h24v24H0V0z" fill="none"/>
10
+ <path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Info
6
+ class InfoComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path fill="none" d="M0 0h24v24H0V0z"/>
10
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for Warning
6
+ class WarningComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
9
+ <path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>
10
+ </svg>
11
+ SVG
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ZoomIn
6
+ class ZoomInComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
9
+ <path d="M0 0h24v24H0V0z" fill="none"/>
10
+ <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zm.5-7H9v2H7v1h2v2h1v-2h2V9h-2z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Blacklight
4
+ module Icons
5
+ # Icon for ZoomOut
6
+ class ZoomOutComponent < Spotlight::IconComponent
7
+ self.svg = <<~SVG
8
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
9
+ <path d="M0 0h24v24H0V0z" fill="none"/>
10
+ <path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7V9z"/>
11
+ </svg>
12
+ SVG
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ <table class="table analytics">
2
+ <tr>
3
+ <% display_fields.each_pair do |key, value| %>
4
+ <td class="value <%= key %>"><%= format_field(key, value) %></td>
5
+ <% end %>
6
+ </tr>
7
+ <tfoot>
8
+ <tr>
9
+ <% display_fields.each_pair do |key, value| %>
10
+ <th><%= I18n.t("spotlight.dashboards.analytics.#{key}") %></th>
11
+ <% end %>
12
+ </tr>
13
+ </tfoot>
14
+ </table>
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module Analytics
5
+ # Display Analytics aggregations as table
6
+ class AggregationComponent < ViewComponent::Base
7
+ def initialize(data:, exclude_fields: nil)
8
+ super
9
+ @exclude_fields = exclude_fields
10
+ @data = data
11
+ end
12
+
13
+ def render?
14
+ display_fields.to_h.present?
15
+ end
16
+
17
+ def display_fields
18
+ return @data unless @exclude_fields
19
+
20
+ filtered_data = @data.to_h.except(*@exclude_fields)
21
+ OpenStruct.new(filtered_data)
22
+ end
23
+
24
+ def format_field(key, value)
25
+ if value.is_a?(Float)
26
+ if key.to_s.downcase.include?('rate')
27
+ "#{(value * 100).to_i}%"
28
+ else
29
+ Kernel.format('%.2f', value)
30
+ end
31
+ else
32
+ value
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,50 @@
1
+ <% if results? %>
2
+ <%= cache current_exhibit, expires_in: 1.hour do %>
3
+ <h2><%= I18n.t("spotlight.dashboards.analytics.reporting_period_heading") %></h2>
4
+ <h3 class="h5 mt-4"><%= I18n.t("spotlight.dashboards.analytics.visitor_header") %></h3>
5
+ <%= render Spotlight::Analytics::AggregationComponent.new(data: page_analytics.totals) %>
6
+
7
+ <h3 class="h5 mt-4"><%= I18n.t("spotlight.dashboards.analytics.session_header") %></h3>
8
+ <%= render Spotlight::Analytics::AggregationComponent.new(data: search_analytics.totals, exclude_fields: [:eventCount] ) %>
9
+
10
+ <% unless page_analytics.rows.empty? %>
11
+ <h3 class="h5 mt-4"><%= I18n.t("spotlight.dashboards.analytics.pages.header") %></h4>
12
+ <table class="table table-striped popular-pages">
13
+ <thead>
14
+ <tr>
15
+ <th><%= I18n.t("spotlight.dashboards.analytics.pagetitle") %></th>
16
+ <th class="text-right text-end"><%= I18n.t("spotlight.dashboards.analytics.pageviews") %></th>
17
+ </tr>
18
+ </thead>
19
+ <% page_analytics.rows.each do |p| %>
20
+ <tr>
21
+ <td><%= link_to p.pageTitle, p.pagePath %></td>
22
+ <td class="text-right text-end"><%= p.screenPageViews %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+ <% end %>
27
+
28
+ <% unless search_analytics.rows.empty? %>
29
+ <h3 class="h5 mt-4"><%= I18n.t("spotlight.dashboards.analytics.searches.header") %></h4>
30
+ <table class="table table-striped popular-pages">
31
+ <thead>
32
+ <tr>
33
+ <th><%= I18n.t("spotlight.dashboards.analytics.searches.term") %></th>
34
+ <th class="text-right text-end"><%= I18n.t("spotlight.dashboards.analytics.searches.views") %></th>
35
+ </tr>
36
+ </thead>
37
+ <% search_analytics.rows.each do |p| %>
38
+ <% if p.searchTerm.present? %>
39
+ <tr>
40
+ <td><%= p.searchTerm %></td>
41
+ <td class="text-right text-end"><%= p.eventCount %></td>
42
+ </tr>
43
+ <% end %>
44
+ <% end %>
45
+ </table>
46
+ <% end %>
47
+ <% end %>
48
+ <% else %>
49
+ <%= I18n.t("spotlight.dashboards.analytics.no_results", pageurl: page_url) %>
50
+ <% end %>
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ module Analytics
5
+ # Display Analytics
6
+ class DashboardComponent < ViewComponent::Base
7
+ attr_reader :current_exhibit, :dates
8
+
9
+ def initialize(current_exhibit:)
10
+ super
11
+ @current_exhibit = current_exhibit
12
+ @dates = { 'start_date' => '365daysAgo', 'end_date' => 'today' }
13
+ end
14
+
15
+ def results?
16
+ page_analytics.totals.to_h.present? || search_analytics.totals.to_h.present?
17
+ end
18
+
19
+ def page_url
20
+ @page_url ||= helpers.exhibit_root_path(current_exhibit)
21
+ end
22
+
23
+ def page_analytics
24
+ @page_analytics ||= current_exhibit.page_analytics(dates, page_url)
25
+ end
26
+
27
+ def search_analytics
28
+ @search_analytics ||= current_exhibit.analytics(dates, page_url)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,36 @@
1
+ <%= content_tag @component,
2
+ id: @id,
3
+ data: {
4
+ 'document-id': @document.id.to_s.parameterize,
5
+ 'document-counter': @counter,
6
+ 'label-toggle': @document.id
7
+ },
8
+ itemscope: true,
9
+ itemtype: @document.itemtype,
10
+ class: classes.flatten.join(' ') do %>
11
+ <% # header bar for doc items in index view -%>
12
+ <td class="spotlight-admin-thumbnail">
13
+ <%= thumbnail %>
14
+ </td>
15
+ <td>
16
+ <%# header bar for doc items in index view -%>
17
+ <div class="documentHeader row" data-label-toggle="<%= @document.id %>">
18
+ <h5 class="index_title col-md-12">
19
+ <%= helpers.link_to_document(presenter.document, itemprop: 'name') %>
20
+ </h5>
21
+ </div>
22
+
23
+ <div class="page-links">
24
+ <%= helpers.view_link presenter.document, helpers.link_to_document(presenter.document) %> &middot;
25
+ <%= helpers.exhibit_edit_link presenter.document, [:edit, helpers.current_exhibit, presenter.document] %>
26
+ </div>
27
+ </td>
28
+
29
+ <td class="text-nowrap">
30
+ <%= timestamp %>
31
+ </td>
32
+
33
+ <td class="checkbox-toggle">
34
+ <%= render partial: 'document_visibility_control', locals: { document: presenter.document} %>
35
+ </td>
36
+ <% end %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ # Displays the document
5
+ # This overrides the title method to provide an edit link.
6
+ class DocumentAdminTableComponent < Blacklight::DocumentComponent
7
+ def initialize(component: 'tr', **kwargs)
8
+ super
9
+ end
10
+
11
+ def classes
12
+ super + ['doc-row']
13
+ end
14
+
15
+ def timestamp
16
+ return unless presenter.document[presenter.configuration.index.timestamp_field]
17
+
18
+ l Date.parse(presenter.document[presenter.configuration.index.timestamp_field])
19
+ rescue StandardError
20
+ nil
21
+ end
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ <%= top_bar %>
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ class HeaderComponent < Blacklight::HeaderComponent
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ # Displays the document
5
+ class IconComponent < Blacklight::Icons::IconComponent
6
+ if Blacklight.version < '8.0'
7
+ # Work around https://github.com/projectblacklight/blacklight/issues/3232 (fixed in Blacklight 8.0)
8
+ def classes
9
+ (@classes - ['blacklight-icons-'] + ["blacklight-icons-#{name}"]).uniq
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ <% if body.present? %>
2
+ <%= body %>
3
+ <% elsif partials? %>
4
+ <% partials.each do |partial| %>
5
+ <%= partial %>
6
+ <% end %>
7
+ <% elsif embed? %>
8
+ <%= embed %>
9
+ <% elsif thumbnail? %>
10
+ <%= thumbnail %>
11
+ <% end %>
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Render an document suitable for embedding on a feature page.
4
+ module Spotlight
5
+ class SolrDocumentLegacyEmbedComponent < Blacklight::DocumentComponent
6
+ end
7
+ end
@@ -89,7 +89,7 @@ module Spotlight
89
89
  if current_exhibit
90
90
  exhibit_search_facet_path(*args, **kwargs)
91
91
  else
92
- main_app.catalog_facet_url(*args, **kwargs)
92
+ main_app.facet_catalog_url(*args, **kwargs)
93
93
  end
94
94
  end
95
95
 
@@ -36,6 +36,8 @@ module Spotlight
36
36
  end
37
37
 
38
38
  def show
39
+ # For Blacklight 8, @document_list will be nil but
40
+ # will be required for Blacklight 7 to work correctly.
39
41
  @response, @document_list = search_service.search_results do |builder|
40
42
  builder.with(params.merge(browse_category_id: @search.id))
41
43
  end
@@ -37,7 +37,11 @@ module Spotlight
37
37
 
38
38
  before_action only: :admin do
39
39
  blacklight_config.view.select! { |k, _v| k == :admin_table }
40
- blacklight_config.view.admin_table(partials: [:index_compact], document_actions: []) unless blacklight_config.view.key? :admin_table
40
+ unless blacklight_config.view.key? :admin_table
41
+ blacklight_config.view.admin_table(document_component: Spotlight::DocumentAdminTableComponent,
42
+ partials: [:index_compact],
43
+ document_actions: [])
44
+ end
41
45
  if Blacklight::VERSION > '8'
42
46
  blacklight_config.track_search_session.storage = false
43
47
  else
@@ -51,7 +55,7 @@ module Spotlight
51
55
  end
52
56
 
53
57
  before_action only: :edit do
54
- blacklight_config.view.edit(partials: blacklight_config.view_config(:show).partials.dup.insert(2, :edit)) unless blacklight_config.view.key? :edit
58
+ blacklight_config.action_mapping.edit.top_level_config = :show
55
59
  end
56
60
 
57
61
  def show
@@ -12,14 +12,15 @@ module Spotlight
12
12
 
13
13
  before_action only: [:show] do
14
14
  blacklight_config.action_mapping&.delete(:show)
15
- blacklight_config.view.clear
16
- blacklight_config.view.admin_table(partials: ['index_compact'], document_actions: [])
15
+ blacklight_config.action_mapping.show.top_level_config = :index if blacklight_config.key?(:action_mapping)
16
+
17
+ blacklight_config.index.document_component = Spotlight::DocumentAdminTableComponent
18
+ blacklight_config.index.document_actions = []
17
19
  if Blacklight::VERSION > '8'
18
20
  blacklight_config.track_search_session.storage = false
19
21
  else
20
22
  blacklight_config.track_search_session = false
21
23
  end
22
- blacklight_config.action_mapping.show.top_level_config = :index if blacklight_config.key?(:action_mapping)
23
24
  end
24
25
 
25
26
  def show