blacklight-spotlight 4.0.2 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -9
  3. data/app/assets/stylesheets/spotlight/_catalog.scss +0 -12
  4. data/app/assets/stylesheets/spotlight/_header.scss +9 -0
  5. data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +4 -4
  6. data/app/components/blacklight/icons/arrow_alt_circle_left_component.rb +15 -0
  7. data/app/components/blacklight/icons/arrow_alt_circle_right_component.rb +15 -0
  8. data/app/components/blacklight/icons/arrow_back_ios_component.rb +15 -0
  9. data/app/components/blacklight/icons/arrow_forward_ios_component.rb +15 -0
  10. data/app/components/blacklight/icons/check_circle_component.rb +15 -0
  11. data/app/components/blacklight/icons/check_component.rb +15 -0
  12. data/app/components/blacklight/icons/chevron_right_component.rb +15 -0
  13. data/app/components/blacklight/icons/close_component.rb +15 -0
  14. data/app/components/blacklight/icons/edit_component.rb +15 -0
  15. data/app/components/blacklight/icons/error_component.rb +14 -0
  16. data/app/components/blacklight/icons/highlight_off_component.rb +15 -0
  17. data/app/components/blacklight/icons/info_component.rb +15 -0
  18. data/app/components/blacklight/icons/warning_component.rb +14 -0
  19. data/app/components/blacklight/icons/zoom_in_component.rb +15 -0
  20. data/app/components/blacklight/icons/zoom_out_component.rb +15 -0
  21. data/app/components/spotlight/analytics/aggregation_component.html.erb +14 -0
  22. data/app/components/spotlight/analytics/aggregation_component.rb +37 -0
  23. data/app/components/spotlight/analytics/dashboard_component.html.erb +50 -0
  24. data/app/components/spotlight/analytics/dashboard_component.rb +32 -0
  25. data/app/components/spotlight/document_admin_table_component.html.erb +36 -0
  26. data/app/components/spotlight/document_admin_table_component.rb +23 -0
  27. data/app/components/spotlight/header_component.html.erb +1 -0
  28. data/app/components/spotlight/header_component.rb +6 -0
  29. data/app/components/spotlight/icon_component.rb +13 -0
  30. data/app/components/spotlight/solr_document_legacy_embed_component.html.erb +11 -0
  31. data/app/components/spotlight/solr_document_legacy_embed_component.rb +7 -0
  32. data/app/controllers/concerns/spotlight/controller.rb +1 -1
  33. data/app/controllers/spotlight/browse_controller.rb +2 -0
  34. data/app/controllers/spotlight/catalog_controller.rb +6 -2
  35. data/app/controllers/spotlight/dashboards_controller.rb +4 -3
  36. data/app/models/concerns/spotlight/exhibit_analytics.rb +6 -4
  37. data/app/models/spotlight/analytics/ga.rb +90 -43
  38. data/app/models/spotlight/blacklight_configuration.rb +8 -1
  39. data/app/views/layouts/spotlight/base.html.erb +2 -2
  40. data/app/views/shared/_header_navbar.html.erb +6 -12
  41. data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -0
  42. data/app/views/spotlight/catalog/_admin_thumbnail_default.html.erb +1 -0
  43. data/app/views/spotlight/catalog/_document_admin_table.html.erb +8 -1
  44. data/app/views/spotlight/catalog/_document_row.html.erb +2 -5
  45. data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -0
  46. data/app/views/spotlight/catalog/edit.html.erb +15 -2
  47. data/app/views/spotlight/dashboards/analytics.html.erb +2 -2
  48. data/app/views/spotlight/pages/_view_type_group.html.erb +2 -5
  49. data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +2 -2
  50. data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +8 -0
  51. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +3 -3
  52. data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
  53. data/config/locales/spotlight.en.yml +16 -4
  54. data/lib/generators/spotlight/templates/catalog_controller.rb +3 -0
  55. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +16 -12
  56. data/lib/spotlight/engine.rb +11 -9
  57. data/lib/spotlight/version.rb +1 -1
  58. data/lib/spotlight.rb +3 -0
  59. data/spec/support/features/test_features_helpers.rb +1 -1
  60. metadata +61 -31
  61. data/app/assets/images/blacklight/arrow-alt-circle-left.svg +0 -1
  62. data/app/assets/images/blacklight/arrow-alt-circle-right.svg +0 -1
  63. data/app/assets/images/blacklight/arrow_back_ios.svg +0 -1
  64. data/app/assets/images/blacklight/arrow_forward_ios.svg +0 -1
  65. data/app/assets/images/blacklight/check.svg +0 -1
  66. data/app/assets/images/blacklight/check_circle.svg +0 -1
  67. data/app/assets/images/blacklight/chevron_right.svg +0 -1
  68. data/app/assets/images/blacklight/close.svg +0 -1
  69. data/app/assets/images/blacklight/edit.svg +0 -1
  70. data/app/assets/images/blacklight/error.svg +0 -1
  71. data/app/assets/images/blacklight/highlight_off.svg +0 -1
  72. data/app/assets/images/blacklight/info.svg +0 -1
  73. data/app/assets/images/blacklight/warning.svg +0 -1
  74. data/app/assets/images/blacklight/zoom_in.svg +0 -1
  75. data/app/assets/images/blacklight/zoom_out.svg +0 -1
  76. data/app/models/spotlight/analytics/ga_model.rb +0 -29
  77. 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: 6167b9ec0f0c5a6ce1635552497626d450d2556d6313898c53b8ec5b3913d02c
4
- data.tar.gz: 1d695b6673fd753b44b34d0f8d8349f8ebd2a1caf72ef2ee11c43fb8b1a06433
3
+ metadata.gz: b9197307a89d83a9c378555c07763888e27517bd4b104d404b6dd5c9d570f6b7
4
+ data.tar.gz: 82a85fa5c50cfb072c1f843213fd82c15e2a5df71c9bda4e1cc18bb2a0b772bc
5
5
  SHA512:
6
- metadata.gz: 96742e7e752440d6cb3fab9f8235198ece467572f4f3f33afed9a2333e2451ae9c44b420076a7aad0455deb8f5d02ffd53df81eb5134d1ccec37bc63d0d9ab27
7
- data.tar.gz: f141de9c3be60f2397d186df634d46b45a0cd7073534500786598f6cff8f836296a32d8bd0827c66c1a7eec37636a8e789704f5e5a1b6c559d7a8a61da70931b
6
+ metadata.gz: f5e48d34d19852384e4d92221dc5dc626211106f5b496265773da2a1f04b36c2a08d45209fef9fd033f419b610145e4bf82194535d572ada6e164aeaa32ebfa6
7
+ data.tar.gz: b985d712d3308eb32b6e6eaf2f0eadff2f77aa72d5b2d04775059dbd60a8bf9f98077c3952e591f7c16592564260c546efdd44006828707068d08f1a29191b95
data/README.md CHANGED
@@ -114,16 +114,24 @@ See [developer-facing instructions for enabling translation](https://github.com/
114
114
  - [Blacklight Development Google group](https://groups.google.com/forum/#!forum/blacklight-development)
115
115
  - [Spotlight Community Group](https://groups.google.com/forum/#!forum/spotlight-community) (equivalent to #spotlight-service)
116
116
 
117
-
118
- ## Building the javascript
119
- The javascript is built by npm from sources in `app/javascript` into a bundle
117
+ ## Updating the JavaScript bundle
118
+ The JavaScript is built by npm from sources in `app/javascript` into a bundle
120
119
  in `app/assets/javascripts/spotlight/spotlight.js`. This file should not be edited
121
- by hand as any changes would be overwritten. When any of the javascript
120
+ by hand as any changes would be overwritten. When any of the JavaScript
122
121
  components in the gem are changed, this bundle should be rebuilt with the
123
122
  following steps:
124
123
  1. [Install npm](https://www.npmjs.com/get-npm)
125
- 2. run `npm install` to download dependencies
126
- 3. make sure that the version in `package.json` matches your intended release version
127
- 4. commit the new `package-lock.json` that reflects the desired version number
128
- 6. run `npm run prepare` to build the bundle
129
- 6. run `npm publish` to push the javascript package to https://npmjs.org/package/spotlight-frontend
124
+ 2. Run `npm install` to download dependencies
125
+ 3. Run `npm run prepare` to build the bundle
126
+ 4. If you are releasing a new version of the gem, follow the release instructions below.
127
+
128
+ ## Releasing a new version and publishing the JavaScript
129
+ You only need to update `package.json` and prepare/publish the JavaScript package for npm if there are changes to the JavaScript.
130
+ 1. Edit `version.rb` and `package.json` to set the new version
131
+ 2. Run `npm run prepare` to build the JavaScript bundle
132
+ 3. Run `npm i --package-lock-only` to update the version in `package-lock.json`
133
+ 4. Commit the changes e.g. `git commit -am "Bump version to X.X.X"`
134
+ 5. Push the release to rubygems and GitHub: `bundle exec rake release`
135
+ 6. Run `npm publish` to push the JavaScript package to https://npmjs.org/package/spotlight-frontend
136
+
137
+ See "Updating the JavaScript bundle" above for more details.
@@ -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