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.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/spotlight/_catalog.scss +0 -12
- data/app/assets/stylesheets/spotlight/_header.scss +9 -0
- data/app/assets/stylesheets/spotlight/browse_group_categories_block.scss +4 -4
- data/app/components/blacklight/icons/arrow_alt_circle_left_component.rb +15 -0
- data/app/components/blacklight/icons/arrow_alt_circle_right_component.rb +15 -0
- data/app/components/blacklight/icons/arrow_back_ios_component.rb +15 -0
- data/app/components/blacklight/icons/arrow_forward_ios_component.rb +15 -0
- data/app/components/blacklight/icons/check_circle_component.rb +15 -0
- data/app/components/blacklight/icons/check_component.rb +15 -0
- data/app/components/blacklight/icons/chevron_right_component.rb +15 -0
- data/app/components/blacklight/icons/close_component.rb +15 -0
- data/app/components/blacklight/icons/edit_component.rb +15 -0
- data/app/components/blacklight/icons/error_component.rb +14 -0
- data/app/components/blacklight/icons/highlight_off_component.rb +15 -0
- data/app/components/blacklight/icons/info_component.rb +15 -0
- data/app/components/blacklight/icons/warning_component.rb +14 -0
- data/app/components/blacklight/icons/zoom_in_component.rb +15 -0
- data/app/components/blacklight/icons/zoom_out_component.rb +15 -0
- data/app/components/spotlight/analytics/aggregation_component.html.erb +14 -0
- data/app/components/spotlight/analytics/aggregation_component.rb +37 -0
- data/app/components/spotlight/analytics/dashboard_component.html.erb +50 -0
- data/app/components/spotlight/analytics/dashboard_component.rb +32 -0
- data/app/components/spotlight/document_admin_table_component.html.erb +36 -0
- data/app/components/spotlight/document_admin_table_component.rb +23 -0
- data/app/components/spotlight/header_component.html.erb +1 -0
- data/app/components/spotlight/header_component.rb +6 -0
- data/app/components/spotlight/icon_component.rb +13 -0
- data/app/components/spotlight/solr_document_legacy_embed_component.html.erb +11 -0
- data/app/components/spotlight/solr_document_legacy_embed_component.rb +7 -0
- data/app/controllers/concerns/spotlight/controller.rb +1 -1
- data/app/controllers/spotlight/browse_controller.rb +2 -0
- data/app/controllers/spotlight/catalog_controller.rb +6 -2
- data/app/controllers/spotlight/dashboards_controller.rb +4 -3
- data/app/models/concerns/spotlight/exhibit_analytics.rb +6 -4
- data/app/models/spotlight/analytics/ga.rb +90 -43
- data/app/models/spotlight/blacklight_configuration.rb +8 -1
- data/app/views/layouts/spotlight/base.html.erb +2 -2
- data/app/views/shared/_header_navbar.html.erb +6 -12
- data/app/views/spotlight/catalog/_admin_index_header_default.html.erb +1 -0
- data/app/views/spotlight/catalog/_admin_thumbnail_default.html.erb +1 -0
- data/app/views/spotlight/catalog/_document_admin_table.html.erb +8 -1
- data/app/views/spotlight/catalog/_document_row.html.erb +2 -5
- data/app/views/spotlight/catalog/_index_compact_default.html.erb +1 -0
- data/app/views/spotlight/catalog/edit.html.erb +15 -2
- data/app/views/spotlight/dashboards/analytics.html.erb +2 -2
- data/app/views/spotlight/pages/_view_type_group.html.erb +2 -5
- data/app/views/spotlight/sir_trevor/blocks/_browse_group_categories_block.html.erb +2 -2
- data/app/views/spotlight/sir_trevor/blocks/_embedded_document.html.erb +8 -0
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb +3 -3
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
- data/config/locales/spotlight.en.yml +16 -4
- data/lib/generators/spotlight/templates/catalog_controller.rb +3 -0
- data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +16 -12
- data/lib/spotlight/engine.rb +11 -9
- data/lib/spotlight/version.rb +1 -1
- data/lib/spotlight.rb +3 -0
- data/spec/support/features/test_features_helpers.rb +1 -1
- metadata +61 -31
- data/app/assets/images/blacklight/arrow-alt-circle-left.svg +0 -1
- data/app/assets/images/blacklight/arrow-alt-circle-right.svg +0 -1
- data/app/assets/images/blacklight/arrow_back_ios.svg +0 -1
- data/app/assets/images/blacklight/arrow_forward_ios.svg +0 -1
- data/app/assets/images/blacklight/check.svg +0 -1
- data/app/assets/images/blacklight/check_circle.svg +0 -1
- data/app/assets/images/blacklight/chevron_right.svg +0 -1
- data/app/assets/images/blacklight/close.svg +0 -1
- data/app/assets/images/blacklight/edit.svg +0 -1
- data/app/assets/images/blacklight/error.svg +0 -1
- data/app/assets/images/blacklight/highlight_off.svg +0 -1
- data/app/assets/images/blacklight/info.svg +0 -1
- data/app/assets/images/blacklight/warning.svg +0 -1
- data/app/assets/images/blacklight/zoom_in.svg +0 -1
- data/app/assets/images/blacklight/zoom_out.svg +0 -1
- data/app/models/spotlight/analytics/ga_model.rb +0 -29
- data/app/views/spotlight/dashboards/_analytics.html.erb +0 -35
@@ -4,18 +4,20 @@ module Spotlight
|
|
4
4
|
##
|
5
5
|
# Exhibit mixin to provide analytics data
|
6
6
|
module ExhibitAnalytics
|
7
|
-
def analytics(
|
7
|
+
def analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil)
|
8
8
|
return OpenStruct.new unless analytics_provider&.enabled?
|
9
9
|
|
10
10
|
@analytics ||= {}
|
11
|
-
|
11
|
+
start_date = dates['start_date'] || 1.month.ago
|
12
|
+
@analytics[start_date] ||= analytics_provider.exhibit_data(path || self, dates)
|
12
13
|
end
|
13
14
|
|
14
|
-
def page_analytics(
|
15
|
+
def page_analytics(dates = { start_date: '365daysAgo', end_date: 'today' }, path = nil)
|
15
16
|
return [] unless analytics_provider&.enabled?
|
16
17
|
|
17
18
|
@page_analytics ||= {}
|
18
|
-
|
19
|
+
start_date = dates['start_date'] || 1.month.ago
|
20
|
+
@page_analytics[start_date] ||= analytics_provider.page_data(path || self, dates)
|
19
21
|
end
|
20
22
|
|
21
23
|
def analytics_provider
|
@@ -1,80 +1,127 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'signet/oauth_2/client'
|
4
|
-
require '
|
4
|
+
require 'google/analytics/data'
|
5
5
|
|
6
6
|
module Spotlight
|
7
7
|
module Analytics
|
8
8
|
##
|
9
9
|
# Google Analytics data provider for the Exhibit dashboard
|
10
10
|
class Ga
|
11
|
-
extend Legato::Model
|
12
|
-
|
13
11
|
def enabled?
|
14
|
-
|
12
|
+
Spotlight::Engine.config.ga_json_key_path && client
|
13
|
+
end
|
14
|
+
|
15
|
+
def client
|
16
|
+
Google::Analytics::Data.analytics_data do |config|
|
17
|
+
config.credentials = Spotlight::Engine.config.ga_json_key_path
|
18
|
+
end
|
19
|
+
rescue StandardError => e
|
20
|
+
Rails.logger.error(e)
|
21
|
+
nil
|
15
22
|
end
|
16
23
|
|
17
|
-
|
24
|
+
def params(path, dates)
|
25
|
+
{
|
26
|
+
date_ranges: [{ start_date: dates['start_date'], end_date: dates['end_date'] }],
|
27
|
+
metric_aggregations: [
|
28
|
+
::Google::Analytics::Data::V1beta::MetricAggregation::TOTAL
|
29
|
+
],
|
30
|
+
property: "properties/#{ga_property_id}",
|
31
|
+
dimension_filter: dimension_filter(path)
|
32
|
+
}
|
33
|
+
end
|
18
34
|
|
19
|
-
def
|
20
|
-
|
35
|
+
def dimension_filter(path)
|
36
|
+
Google::Analytics::Data::V1beta::FilterExpression.new(
|
37
|
+
filter: Google::Analytics::Data::V1beta::Filter.new(
|
38
|
+
field_name: 'pagePath',
|
39
|
+
string_filter: Google::Analytics::Data::V1beta::Filter::StringFilter.new(
|
40
|
+
match_type: :BEGINS_WITH,
|
41
|
+
value: path.to_s
|
42
|
+
)
|
43
|
+
)
|
44
|
+
)
|
21
45
|
end
|
22
46
|
|
23
|
-
def
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
47
|
+
def search_params(path, dates)
|
48
|
+
params(path, dates).merge({ dimensions: [{ name: 'searchTerm' }],
|
49
|
+
metrics: [{ name: 'eventCount' }, { name: 'sessions' },
|
50
|
+
{ name: 'screenPageViewsPerSession' }, { name: 'engagementRate' }],
|
51
|
+
order_bys: [{ metric: { metric_name: 'eventCount' },
|
52
|
+
desc: true }] }).merge(Spotlight::Engine.config.ga_search_analytics_options)
|
53
|
+
end
|
28
54
|
|
29
|
-
|
55
|
+
def page_params(path, dates)
|
56
|
+
params(path, dates).merge({
|
57
|
+
dimensions: [{ name: 'pagePath' }, { name: 'pageTitle' }],
|
58
|
+
order_bys: [{ metric: { metric_name: 'screenPageViews' }, desc: true }],
|
59
|
+
metrics: [{ name: 'totalUsers' }, { name: 'activeUsers' },
|
60
|
+
{ name: 'screenPageViews' }]
|
61
|
+
}).merge(Spotlight::Engine.config.ga_page_analytics_options)
|
30
62
|
end
|
31
63
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
rescue StandardError => e
|
36
|
-
Rails.logger.info(e)
|
37
|
-
nil
|
38
|
-
end
|
64
|
+
def report(params)
|
65
|
+
request = ::Google::Analytics::Data::V1beta::RunReportRequest.new(params)
|
66
|
+
client.run_report request
|
39
67
|
end
|
40
68
|
|
41
|
-
def
|
42
|
-
|
69
|
+
def page_data(path, dates)
|
70
|
+
metric_parsing(report(page_params(path, dates)))
|
43
71
|
end
|
44
72
|
|
45
|
-
|
73
|
+
def parse_data(value)
|
74
|
+
if value.to_i.to_s == value
|
75
|
+
value.to_i.to_fs(:delimited)
|
76
|
+
elsif !!(value =~ /\A[-+]?\d*\.?\d+\z/)
|
77
|
+
value.to_f
|
78
|
+
else
|
79
|
+
value
|
80
|
+
end
|
81
|
+
end
|
46
82
|
|
47
|
-
def
|
48
|
-
|
83
|
+
def exhibit_data(path, dates)
|
84
|
+
metric_parsing(report(search_params(path, dates)))
|
49
85
|
end
|
50
86
|
|
51
|
-
def
|
52
|
-
OpenStruct.new(
|
87
|
+
def totals
|
88
|
+
OpenStruct.new(@report_data.totals[0].metric_values.each_with_index.with_object({}) do |(mv, index), result|
|
89
|
+
result[metric_headers[index]] = parse_data(mv.value)
|
90
|
+
end)
|
53
91
|
end
|
54
92
|
|
55
|
-
|
56
|
-
|
93
|
+
# rubocop:disable Metrics/AbcSize
|
94
|
+
def rows
|
95
|
+
@report_data.rows.map do |row|
|
96
|
+
OpenStruct.new(row.dimension_values.each_with_index.with_object({}) do |(dv, index), result|
|
97
|
+
result[dimension_headers[index]] = parse_data(dv.value)
|
98
|
+
end.merge(row.metric_values.each_with_index.with_object({}) do |(mv, index), result|
|
99
|
+
result[metric_headers[index]] = parse_data(mv.value)
|
100
|
+
end))
|
101
|
+
end
|
102
|
+
end
|
103
|
+
# rubocop:enable Metrics/AbcSize
|
57
104
|
|
58
|
-
|
59
|
-
|
105
|
+
def metric_headers
|
106
|
+
@report_data.metric_headers.map(&:name)
|
60
107
|
end
|
61
108
|
|
62
|
-
def
|
63
|
-
|
64
|
-
token_url: 'https://accounts.google.com/o/oauth2/token')
|
109
|
+
def dimension_headers
|
110
|
+
@report_data.dimension_headers.map(&:name)
|
65
111
|
end
|
66
112
|
|
67
|
-
def
|
68
|
-
|
113
|
+
def metric_parsing(report_data)
|
114
|
+
return OpenStruct.new({ totals: [], rows: [] }) unless report_data.rows.any?
|
115
|
+
|
116
|
+
@report_data = report_data
|
117
|
+
|
118
|
+
OpenStruct.new({ rows: rows, totals: totals })
|
69
119
|
end
|
70
120
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
issuer: Spotlight::Engine.config.ga_email,
|
76
|
-
signing_key: signing_key,
|
77
|
-
sub: Spotlight::Engine.config.ga_email
|
121
|
+
private
|
122
|
+
|
123
|
+
def ga_property_id
|
124
|
+
Spotlight::Engine.config.ga_property_id
|
78
125
|
end
|
79
126
|
end
|
80
127
|
end
|
@@ -121,8 +121,15 @@ module Spotlight
|
|
121
121
|
config.default_per_page = default_per_page if default_per_page
|
122
122
|
|
123
123
|
config.view.embed!
|
124
|
-
|
124
|
+
# This is blacklight-gallery's openseadragon partial
|
125
|
+
unless config.view.embed.document_component
|
126
|
+
config.view.embed.partials ||= ['openseadragon']
|
127
|
+
config.view.embed.document_component = Spotlight::SolrDocumentLegacyEmbedComponent
|
128
|
+
end
|
125
129
|
config.view.embed.if = false
|
130
|
+
|
131
|
+
# blacklight-gallery requires tile_source_field
|
132
|
+
config.view.embed.tile_source_field ||= config.show.tile_source_field
|
126
133
|
config.view.embed.locals ||= { osd_container_class: '' }
|
127
134
|
|
128
135
|
# Add any custom fields
|
@@ -26,9 +26,9 @@
|
|
26
26
|
<%= render partial: 'shared/body_preamble' %>
|
27
27
|
<div id="skip-link">
|
28
28
|
<% if should_render_spotlight_search_bar? %>
|
29
|
-
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: '
|
29
|
+
<%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'btn btn-link bg-light sr-only sr-only-focusable visually-hidden-focusable' %>
|
30
30
|
<% end %>
|
31
|
-
<%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: '
|
31
|
+
<%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'btn btn-link bg-light sr-only sr-only-focusable visually-hidden-focusable' %>
|
32
32
|
<%= content_for(:skip_links) %>
|
33
33
|
</div>
|
34
34
|
|
@@ -1,12 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<div class="collapse navbar-collapse justify-content-md-end" id="user-util-collapse">
|
9
|
-
<%= render partial: 'shared/user_util_links' %>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
</nav>
|
1
|
+
<% if blacklight_config.header_component.present? && blacklight_config.header_component != Blacklight::HeaderComponent %>
|
2
|
+
<%= render blacklight_config.header_component.new(blacklight_config: blacklight_config) %>
|
3
|
+
<% else %>
|
4
|
+
<%= render Spotlight::HeaderComponent.new(blacklight_config: blacklight_config) %>
|
5
|
+
<% Spotlight.deprecator.warn("_header_navbar.html.erb will be deprecated in future versions. Please use Blacklight configuration to specify your HeaderComponent.") %>
|
6
|
+
<% end %>
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<%# header bar for doc items in index view -%>
|
2
|
+
<%- Spotlight.deprecator.warn 'The partial _spotlight/catalog/admin_index_header_default.html.erb will be removed; customize the admin display using components instead' %>
|
2
3
|
<div class="documentHeader row" data-label-toggle="<%= document.id %>">
|
3
4
|
<%# main title container for doc partial view
|
4
5
|
How many bootstrap columns need to be reserved
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<%- Spotlight.deprecator.warn 'The partial _spotlight/catalog/_admin_thumbnail.html.erb will be removed; customize the admin display using components instead' %>
|
1
2
|
<% doc_presenter = document_presenter(document) %>
|
2
3
|
<%- if doc_presenter.thumbnail.exists? %>
|
3
4
|
<div class="document-thumbnail spotlight-admin-thumbnail">
|
@@ -1,4 +1,5 @@
|
|
1
1
|
<% # container for all documents in index view -%>
|
2
|
+
<% view_config = local_assigns[:view_config] || blacklight_config&.view_config(default_document_index_view_type) %>
|
2
3
|
<table id="documents" class="table">
|
3
4
|
<thead>
|
4
5
|
<tr>
|
@@ -8,5 +9,11 @@
|
|
8
9
|
<th scope="col" class="checkbox-toggle"><%= t(:'spotlight.catalog.fields.visibility') %></th>
|
9
10
|
</tr>
|
10
11
|
</thead>
|
11
|
-
|
12
|
+
|
13
|
+
<% if Blacklight.version < '8.0' %>
|
14
|
+
<%= render view_config.document_component.with_collection(documents) %>
|
15
|
+
<% else %>
|
16
|
+
<% document_presenters = documents.map { |doc| document_presenter(doc) } -%>
|
17
|
+
<%= render view_config.document_component.with_collection(document_presenters) %>
|
18
|
+
<% end %>
|
12
19
|
</table>
|
@@ -1,5 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<%= render_document_partials document, blacklight_config.view_config(document_index_view_type).partials, :document_counter => document_counter %>
|
4
|
-
</tr>
|
5
|
-
|
1
|
+
<%- Spotlight.deprecator.warn 'The partial _spotlight/catalog/_document_row.html.erb will be removed; customize the admin display using components instead' %>
|
2
|
+
<%= render Spotlight::DocumentAdminTableComponent.new(presenter: document_presenter(document)) %>
|
@@ -1,3 +1,4 @@
|
|
1
|
+
<%- Spotlight.deprecator.warn 'The partial _spotlight/catalog/_index_compact_default.html.erb will be removed; customize the admin display using components instead' %>
|
1
2
|
<% # header bar for doc items in index view -%>
|
2
3
|
<td>
|
3
4
|
<%= render_document_partial document, 'admin_thumbnail', document_counter: document_counter %>
|
@@ -1,3 +1,16 @@
|
|
1
|
-
<div
|
2
|
-
|
1
|
+
<div class="container">
|
2
|
+
<div class="row">
|
3
|
+
<%- view_config = blacklight_config.view_config(action_name: :edit) %>
|
4
|
+
<%= render (view_config.document_component || Blacklight::DocumentComponent).new(presenter: document_presenter(@document), classes: ['col-md-8'], component: :div, show: true, actions: false, partials: view_config.partials) do |component| %>
|
5
|
+
<% component.with_title(as: 'h1', classes: '', link_to_document: false) %>
|
6
|
+
<% component.with_body do %>
|
7
|
+
<% view_config.partials.each do |view_partial| %>
|
8
|
+
<%= render_document_partial @document, view_partial, component: component, document_counter: 1 %>
|
9
|
+
<% end %>
|
10
|
+
<% end if Blacklight.version < '8.0' && view_config.document_component.blank? %>
|
11
|
+
<% end %>
|
12
|
+
<div class="col-md-4">
|
13
|
+
<%= render 'edit_default', document: @document %>
|
14
|
+
</div>
|
15
|
+
</div>
|
3
16
|
</div>
|
@@ -5,9 +5,9 @@
|
|
5
5
|
<%= curation_page_title %>
|
6
6
|
|
7
7
|
<% if current_exhibit.analytics_provider&.enabled? %>
|
8
|
-
<%= render
|
8
|
+
<%= render Spotlight::Analytics::DashboardComponent.new(current_exhibit: current_exhibit) %>
|
9
9
|
<% else %>
|
10
10
|
<div class="empty-page-block">
|
11
|
-
<p>In order to view exhibit analytics, the site administrator must
|
11
|
+
<p>In order to view exhibit analytics, the site administrator must configure an analytics provider.</p>
|
12
12
|
</div>
|
13
13
|
<% end %>
|
@@ -3,11 +3,8 @@
|
|
3
3
|
<div class="view-type">
|
4
4
|
<span class="sr-only visually-hidden"><%= t('blacklight.search.view_title') %></span>
|
5
5
|
<div class="view-type-group btn-group">
|
6
|
-
<% views.each do |
|
7
|
-
<%=
|
8
|
-
<%= blacklight_icon config.icon || view %>
|
9
|
-
<span class="caption"><%= t("blacklight.search.view.#{view}") %></span>
|
10
|
-
<% end %>
|
6
|
+
<% views.each do |key, config| %>
|
7
|
+
<%= render Blacklight::Response::ViewTypeButtonComponent.new(key: key, view: config, selected: block_document_index_view_type(block) == key, search_state: search_state) %>
|
11
8
|
<% end %>
|
12
9
|
</div>
|
13
10
|
</div>
|
@@ -11,10 +11,10 @@
|
|
11
11
|
<% if group.searches.count > 1 %>
|
12
12
|
<ul class="browse-group-categories-controls p-0 pt-2 pt-md-0 ml-md-auto ms-md-auto mb-0 d-flex justify-content-center align-items-end">
|
13
13
|
<li class="prev px-1 overflow-hidden">
|
14
|
-
<%= blacklight_icon '
|
14
|
+
<%= blacklight_icon 'arrow_alt_circle_left' %>
|
15
15
|
</li>
|
16
16
|
<li class="next px-1 overflow-hidden">
|
17
|
-
<%= blacklight_icon '
|
17
|
+
<%= blacklight_icon 'arrow_alt_circle_right' %>
|
18
18
|
</li>
|
19
19
|
</ul>
|
20
20
|
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="box" data-id="<%= document.id %>">
|
2
|
+
<% view_config = blacklight_config.view_config(:embed) %>
|
3
|
+
<%= render (view_config.document_component || Spotlight::SolrDocumentLegacyEmbedComponent).new((Blacklight.version > '8.0' ? :document : :presenter) => document_presenter(document), counter: nil) do |component| %>
|
4
|
+
<% component.with_partial do %>
|
5
|
+
<%= render_document_partials document, view_config.partials, component: component, document_counter: nil, view_config: view_config, block: local_assigns[:block], **(view_config.locals) %>
|
6
|
+
<% end if view_config&.partials&.any? %>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
@@ -11,10 +11,10 @@
|
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
<div class="spotlight-flexbox">
|
14
|
+
<%# Render the openseadragon viewer from blacklight-gallery.
|
15
|
+
# Settings in blacklight_configuration.rb %>
|
14
16
|
<% solr_documents_embed_block.each_document do |block_options, document| %>
|
15
|
-
|
16
|
-
<%= render_document_partials document, blacklight_config.view.embed.partials, (blacklight_config.view.embed.locals || {}).reverse_merge(block: solr_documents_embed_block) %>
|
17
|
-
</div>
|
17
|
+
<%= render '/spotlight/sir_trevor/blocks/embedded_document', document: document, block: solr_documents_embed_block %>
|
18
18
|
<% end %>
|
19
19
|
</div>
|
20
20
|
</div>
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<% caption_text = solr_documents_features_block.document_caption(doc_presenter, solr_documents_features_block.primary_caption_field, default: Spotlight::PageConfigurations::DOCUMENT_TITLE_KEY) %>
|
26
26
|
|
27
27
|
<a href="#" title="<%= caption_text %>">
|
28
|
-
<%= truncate(caption_text, length: 95) %>
|
28
|
+
<%= truncate(caption_text.to_s, length: 95) %>
|
29
29
|
</a>
|
30
30
|
<% if solr_documents_features_block.secondary_caption? %>
|
31
31
|
<p><%= solr_documents_features_block.document_caption(doc_presenter, solr_documents_features_block.secondary_caption_field) %></p>
|
@@ -481,14 +481,26 @@ en:
|
|
481
481
|
header: Add exhibit-specific field
|
482
482
|
dashboards:
|
483
483
|
analytics:
|
484
|
+
activeUsers: unique visits
|
485
|
+
engagementRate: engagement rate
|
484
486
|
header: Analytics
|
485
|
-
|
487
|
+
no_results: There are no analytics for the path "%{pageurl}"
|
486
488
|
pages:
|
487
489
|
header: Most popular pages
|
488
|
-
pagetitle:
|
489
|
-
pageviews:
|
490
|
-
|
490
|
+
pagetitle: Page title
|
491
|
+
pageviews: Page views
|
492
|
+
reporting_period_heading: User activity over the past year
|
493
|
+
screenPageViews: page views
|
494
|
+
screenPageViewsPerSession: pages per session
|
495
|
+
searches:
|
496
|
+
header: Most used search terms
|
497
|
+
term: Search term
|
498
|
+
views: Searches
|
499
|
+
session_header: Sessions
|
500
|
+
sessions: sessions
|
501
|
+
totalUsers: visitors
|
491
502
|
users: unique visits
|
503
|
+
visitor_header: Visitors
|
492
504
|
page_activity:
|
493
505
|
field:
|
494
506
|
last_edited_by: User
|
@@ -13,6 +13,9 @@ class CatalogController < ApplicationController
|
|
13
13
|
fl: '*'
|
14
14
|
}
|
15
15
|
|
16
|
+
# Blacklight 8 sets a default value to 'advanced'
|
17
|
+
config.json_solr_path = nil
|
18
|
+
config.header_component = Spotlight::HeaderComponent
|
16
19
|
config.document_solr_path = 'get'
|
17
20
|
config.document_unique_id_param = 'ids'
|
18
21
|
|
@@ -42,21 +42,21 @@
|
|
42
42
|
|
43
43
|
# ==> Uploaded item configuration
|
44
44
|
# Spotlight::Engine.config.upload_fields = [
|
45
|
-
# UploadFieldConfig.new(
|
46
|
-
# field_name: config.upload_description_field,
|
47
|
-
# label: -> { I18n.t(:"spotlight.search.fields.#{config.upload_description_field}") },
|
45
|
+
# Spotlight::UploadFieldConfig.new(
|
46
|
+
# field_name: Spotlight::Engine.config.upload_description_field,
|
47
|
+
# label: -> { I18n.t(:"spotlight.search.fields.#{Spotlight::Engine.config.upload_description_field}") },
|
48
48
|
# form_field_type: :text_area
|
49
49
|
# ),
|
50
|
-
# UploadFieldConfig.new(
|
50
|
+
# Spotlight::UploadFieldConfig.new(
|
51
51
|
# field_name: :spotlight_upload_attribution_tesim,
|
52
52
|
# label: -> { I18n.t(:'spotlight.search.fields.spotlight_upload_attribution_tesim') }
|
53
53
|
# ),
|
54
|
-
# UploadFieldConfig.new(
|
54
|
+
# Spotlight::UploadFieldConfig.new(
|
55
55
|
# field_name: :spotlight_upload_date_tesim,
|
56
56
|
# label: -> { I18n.t(:'spotlight.search.fields.spotlight_upload_date_tesim') }
|
57
57
|
# )
|
58
58
|
# ]
|
59
|
-
# Spotlight::Engine.config.upload_title_field = nil # UploadFieldConfig.new(...)
|
59
|
+
# Spotlight::Engine.config.upload_title_field = nil # Spotlight::UploadFieldConfig.new(...)
|
60
60
|
# Spotlight::Engine.config.uploader_storage = :file
|
61
61
|
# Spotlight::Engine.config.allowed_upload_extensions = %w(jpg jpeg png)
|
62
62
|
|
@@ -65,17 +65,21 @@
|
|
65
65
|
|
66
66
|
# ==> Google Analytics integration
|
67
67
|
# After creating a property for your site on Google Analytics, you need to:
|
68
|
-
# a)
|
69
|
-
#
|
70
|
-
#
|
71
|
-
# c) set
|
68
|
+
# a) Enable Google Analytics API in https://console.cloud.google.com/
|
69
|
+
# b) generate and download the JSON key and make it accessible to your application
|
70
|
+
# (https://console.cloud.google.com/iam-admin/iam -> Service accounts -> click on service account -> keys)
|
71
|
+
# c) set ga_property_id below to your site's property id (located in admin -> Property -> Property details upper right hand corner)
|
72
|
+
# d) Set the ga_web_property_id. (located in admin -> Data collection and modification -> Web stream details and begins with G-)
|
73
|
+
# ga_property_id is used for fetching analytics data from google's api, ga_web_property_id is used for sending events to GA analtyics
|
74
|
+
# ga_web_property_id will probably change in V5 to ga_measurement_id for clarity
|
72
75
|
# Rails.application.config.to_prepare do
|
73
76
|
# Spotlight::Engine.config.analytics_provider = Spotlight::Analytics::Ga
|
74
|
-
# Spotlight::Engine.config.
|
77
|
+
# Spotlight::Engine.config.ga_json_key_path = nil
|
75
78
|
# Spotlight::Engine.config.ga_web_property_id = 'G-XXXXXXXXXX'
|
76
|
-
# Spotlight::Engine.config.
|
79
|
+
# Spotlight::Engine.config.ga_property_id = '12345678'
|
77
80
|
# Spotlight::Engine.config.ga_analytics_options = {}
|
78
81
|
# Spotlight::Engine.config.ga_page_analytics_options = Spotlight::Engine.config.ga_analytics_options.merge(limit: 5)
|
82
|
+
# Spotlight::Engine.config.ga_search_analytics_options = Spotlight::Engine.config.ga_analytics_options.merge(limit: 11)
|
79
83
|
# Spotlight::Engine.config.ga_debug_mode = false
|
80
84
|
# end
|
81
85
|
|
data/lib/spotlight/engine.rb
CHANGED
@@ -196,14 +196,16 @@ module Spotlight
|
|
196
196
|
end
|
197
197
|
|
198
198
|
# After creating a property for your site on Google Analytics, you need to:
|
199
|
-
# a)
|
200
|
-
#
|
201
|
-
#
|
202
|
-
# c) in
|
203
|
-
#
|
204
|
-
|
199
|
+
# a) Enable Google Analytics API in https://console.cloud.google.com/
|
200
|
+
# b) generate and download the JSON key and make it accessible to your application
|
201
|
+
# (https://console.cloud.google.com/iam-admin/iam -> Service accounts -> click on service account -> keys)
|
202
|
+
# c) set ga_property_id below to your site's property id (located in admin -> Property -> Property details upper right hand corner)
|
203
|
+
# d) Set the ga_web_property_id. (located in admin -> Data collection and modification -> Web stream details and begins with G-)
|
204
|
+
# ga_property_id is used for fetching analytics data from google's api, ga_web_property_id is used for sending events to GA analtyics
|
205
|
+
# ga_web_property_id will probably change in V5 to ga_measurement_id for clarity
|
206
|
+
config.ga_json_key_path = nil
|
205
207
|
config.ga_web_property_id = nil
|
206
|
-
config.
|
208
|
+
config.ga_property_id = nil
|
207
209
|
config.ga_analytics_options = {}
|
208
210
|
config.ga_page_analytics_options = config.ga_analytics_options.merge(limit: 5)
|
209
211
|
config.ga_debug_mode = false
|
@@ -271,7 +273,7 @@ module Spotlight
|
|
271
273
|
Blacklight::Configuration.property :browse, default: Blacklight::OpenStructWithHashAccess.new(document_actions: [])
|
272
274
|
|
273
275
|
Blacklight::Configuration.default_values[:search_state_fields] ||= []
|
274
|
-
Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id]
|
276
|
+
Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id browse_category_id]
|
275
277
|
end
|
276
278
|
else
|
277
279
|
config.to_prepare do
|
@@ -284,7 +286,7 @@ module Spotlight
|
|
284
286
|
Blacklight::Configuration.default_values[:browse] ||= Blacklight::OpenStructWithHashAccess.new(document_actions: [])
|
285
287
|
|
286
288
|
Blacklight::Configuration.default_values[:search_state_fields] ||= []
|
287
|
-
Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id]
|
289
|
+
Blacklight::Configuration.default_values[:search_state_fields] += %i[id exhibit_id browse_category_id]
|
288
290
|
end
|
289
291
|
end
|
290
292
|
|
data/lib/spotlight/version.rb
CHANGED
data/lib/spotlight.rb
CHANGED