warclight 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/CHANGELOG.md +17 -0
- data/app/assets/javascripts/warclight/warclight.js +0 -2
- data/app/models/concerns/warclight/solr_document.rb +13 -0
- data/lib/generators/warclight/templates/catalog_controller.rb +10 -9
- data/lib/warclight/version.rb +1 -1
- data/solr/conf/solrconfig.xml +18 -20
- data/template.rb +1 -1
- metadata +2 -3
- data/app/assets/javascripts/warclight/oembed_viewer.js +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dfb09424453dcf42c6d11f0ae31c6fb2db9cf35
|
4
|
+
data.tar.gz: 2a479ba8653d7a49771dd844ef79012fdf9fcd84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 364bcd61d925d71036fd089b27556a4f8f6587a47f7c36af3584cdfe17577f252a21568614bb888560eafc6f55e95e5b2212c3326ad041beb2d3d0a1fe8570f9
|
7
|
+
data.tar.gz: d054e07be0178a744e818cd08912c75ac0eb0420d4577ec4f7c3e211220e42d0e85c09cefbbb93c3322f488437f9a2493c720ae6a2ef9dfc0af6054f92b76d7f
|
data/.rubocop.yml
CHANGED
@@ -17,6 +17,7 @@ Metrics/LineLength:
|
|
17
17
|
Max: 120
|
18
18
|
Exclude:
|
19
19
|
- 'Gemfile'
|
20
|
+
- 'spec/models/concerns/warclight/solr_document_spec.rb'
|
20
21
|
|
21
22
|
Metrics/ModuleLength:
|
22
23
|
Max: 120
|
@@ -34,12 +35,17 @@ Metrics/BlockLength:
|
|
34
35
|
- 'spec/**/*'
|
35
36
|
- 'lib/warclight/custom_document.rb'
|
36
37
|
|
38
|
+
Metrics/AbcSize:
|
39
|
+
Exclude:
|
40
|
+
- 'app/models/concerns/warclight/solr_document.rb' #Come back to this later
|
41
|
+
|
37
42
|
Performance/RegexpMatch:
|
38
43
|
Enabled: false
|
39
44
|
|
40
45
|
Rails/OutputSafety:
|
41
46
|
Exclude:
|
42
47
|
- 'app/controllers/concerns/warclight/field_config_helpers.rb' # html_safe needs to be called to mimic BL JOIN behavior
|
48
|
+
- 'app/models/concerns/warclight/solr_document.rb'
|
43
49
|
|
44
50
|
RSpec/ExampleLength:
|
45
51
|
Enabled: false
|
@@ -50,6 +56,10 @@ RSpec/MultipleExpectations:
|
|
50
56
|
RSpec/NestedGroups:
|
51
57
|
Max: 4
|
52
58
|
|
59
|
+
Rails/TimeZone:
|
60
|
+
Exclude:
|
61
|
+
- 'app/models/concerns/warclight/solr_document.rb' #Come back to this later
|
62
|
+
|
53
63
|
Style/Documentation:
|
54
64
|
Exclude:
|
55
65
|
- 'spec/**/*'
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/archivesunleashed/warclight/tree/v0.3.0) (2017-10-11)
|
4
|
+
[Full Changelog](https://github.com/archivesunleashed/warclight/compare/v0.2.0...v0.3.0)
|
5
|
+
|
6
|
+
**Implemented enhancements:**
|
7
|
+
|
8
|
+
- Document titles occasionally seem off [\#18](https://github.com/archivesunleashed/warclight/issues/18)
|
9
|
+
- Truncate fields on search results display? [\#9](https://github.com/archivesunleashed/warclight/issues/9)
|
10
|
+
|
11
|
+
**Closed issues:**
|
12
|
+
|
13
|
+
- Change resourcename type from text\_general to string [\#24](https://github.com/archivesunleashed/warclight/issues/24)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Add helper method to truncate arrays; Resolves \#9 [\#28](https://github.com/archivesunleashed/warclight/pull/28) ([ruebot](https://github.com/ruebot))
|
18
|
+
- Add live http status code check for linking out urls; Resolves \#26. [\#27](https://github.com/archivesunleashed/warclight/pull/27) ([ruebot](https://github.com/ruebot))
|
19
|
+
|
3
20
|
## [v0.2.0](https://github.com/archivesunleashed/warclight/tree/v0.2.0) (2017-09-07)
|
4
21
|
[Full Changelog](https://github.com/archivesunleashed/warclight/compare/v0.1.1...v0.2.0)
|
5
22
|
|
@@ -5,5 +5,18 @@ module Warclight
|
|
5
5
|
# Extends Blacklight::Solr::Document to provide Warclight specific behavior
|
6
6
|
module SolrDocument
|
7
7
|
extend Blacklight::Solr::Document
|
8
|
+
|
9
|
+
def replay_link
|
10
|
+
time_travel_base_url = 'http://timetravel.mementoweb.org/api/json/'
|
11
|
+
time_travel_time_format = '%Y%m%d%H%M%S'
|
12
|
+
time_travel_time = (Time.parse(first(:crawl_date)).strftime time_travel_time_format).to_s
|
13
|
+
time_travel_request_url = time_travel_base_url + time_travel_time + '/' + first(:url).to_s
|
14
|
+
time_travel_request = URI(time_travel_request_url)
|
15
|
+
time_travel_response = Net::HTTP.get(time_travel_request)
|
16
|
+
time_travel_response_json = JSON.parse(time_travel_response)
|
17
|
+
replay_url = time_travel_response_json['mementos']['closest']['uri'][0]
|
18
|
+
replay_url_link = '<a href="' + "#{replay_url}" '" target="_blank">'"#{replay_url}"'</a> 🔗'
|
19
|
+
replay_url_link.html_safe
|
20
|
+
end
|
8
21
|
end
|
9
22
|
end
|
@@ -20,7 +20,7 @@ class CatalogController < ApplicationController
|
|
20
20
|
}
|
21
21
|
|
22
22
|
# solr field configuration for search results/index views
|
23
|
-
config.index.title_field = ['title', '
|
23
|
+
config.index.title_field = ['title', 'resourcename']
|
24
24
|
|
25
25
|
# solr fields that will be treated as facets by the blacklight application
|
26
26
|
# The ordering of the field names is the order of the display
|
@@ -48,16 +48,16 @@ class CatalogController < ApplicationController
|
|
48
48
|
# :index_range can be an array or range of prefixes that will be used to
|
49
49
|
# create the navigation (note: It is case sensitive when searching values)
|
50
50
|
|
51
|
-
config.add_facet_field 'content_type_norm', label: 'General Content Type', collapse: false
|
52
|
-
config.add_facet_field 'crawl_year', label: 'Crawl Year', collapse: false
|
51
|
+
config.add_facet_field 'content_type_norm', label: 'General Content Type', collapse: false, limit: true
|
52
|
+
config.add_facet_field 'crawl_year', label: 'Crawl Year', collapse: false, limit: true, sort: 'index'
|
53
53
|
config.add_facet_field 'public_suffix', label: 'Public Suffix', collapse: false, limit: true
|
54
54
|
config.add_facet_field 'domain', label: 'Domain', limit: true
|
55
55
|
config.add_facet_field 'links_domains', label: 'Links Domains', limit: true
|
56
56
|
config.add_facet_field 'content_language', label: 'Content Language', limit: true
|
57
|
-
config.add_facet_field 'resourcename_s', label: '
|
58
|
-
config.add_facet_field 'institution', label: 'Institution'
|
59
|
-
config.add_facet_field 'collection_name', label: 'Collection Name'
|
60
|
-
config.add_facet_field 'collection_number', label: 'Collection Number'
|
57
|
+
config.add_facet_field 'resourcename_s', label: 'Resource Name', limit: true
|
58
|
+
config.add_facet_field 'institution', label: 'Institution', limit: true
|
59
|
+
config.add_facet_field 'collection_name', label: 'Collection Name', limit: true
|
60
|
+
config.add_facet_field 'collection_number', label: 'Collection Number', limit: true
|
61
61
|
|
62
62
|
# Have BL send all facet field names to Solr, which has been the default
|
63
63
|
# previously. Simply remove these lines if you'd rather use Solr request
|
@@ -80,13 +80,14 @@ class CatalogController < ApplicationController
|
|
80
80
|
# solr fields to be displayed in the show (single result) view
|
81
81
|
# The ordering of the field names is the order of the display
|
82
82
|
config.add_show_field 'url', label: 'URL', helper_method: :url_to_link
|
83
|
-
config.add_show_field '
|
83
|
+
config.add_show_field 'replay_url', label: 'Replay URL', accessor: :replay_link
|
84
|
+
config.add_show_field 'resourcename', label: 'Resource Name', link_to_facet: true
|
84
85
|
config.add_show_field 'host', label: 'Host', link_to_facet: true
|
85
86
|
config.add_show_field 'institution', label: 'Institution', link_to_facet: true
|
86
87
|
config.add_show_field 'collection_name', label: 'Collection Name', link_to_facet: true
|
87
88
|
config.add_show_field 'collection_number', label: 'Collection Number', link_to_facet: true
|
88
89
|
config.add_show_field 'crawl_date', label: 'Crawl Date'
|
89
|
-
config.add_show_field 'source_file', label: 'Source File'
|
90
|
+
config.add_show_field 'source_file', label: 'Source File', link_to_facet: true
|
90
91
|
config.add_show_field 'content_type_norm', label: 'General Content Type', link_to_facet: true
|
91
92
|
config.add_show_field 'content_language', label: 'Content Language', link_to_facet: true
|
92
93
|
config.add_show_field 'content_length', label: 'Length'
|
data/lib/warclight/version.rb
CHANGED
data/solr/conf/solrconfig.xml
CHANGED
@@ -92,28 +92,26 @@
|
|
92
92
|
<int name="rows">10</int>
|
93
93
|
<str name="q.alt">*:*</str>
|
94
94
|
<str name="qf">
|
95
|
-
title^
|
96
|
-
author^
|
97
|
-
keywords^
|
98
|
-
description^
|
99
|
-
wct_title_^
|
100
|
-
wct_description^
|
101
|
-
url^
|
102
|
-
content^
|
103
|
-
host^
|
104
|
-
text^25
|
95
|
+
title^10
|
96
|
+
author^10
|
97
|
+
keywords^9
|
98
|
+
description^8.5
|
99
|
+
wct_title_^10
|
100
|
+
wct_description^8.5
|
101
|
+
url^15
|
102
|
+
content^5
|
103
|
+
host^5
|
105
104
|
</str>
|
106
105
|
<str name="pf">
|
107
|
-
title^
|
108
|
-
author^
|
109
|
-
keywords^
|
110
|
-
description^
|
111
|
-
wct_title^
|
112
|
-
wct_description^
|
113
|
-
url^
|
114
|
-
content^
|
115
|
-
host^
|
116
|
-
text^25
|
106
|
+
title^10
|
107
|
+
author^10
|
108
|
+
keywords^9
|
109
|
+
description^8.5
|
110
|
+
wct_title^10
|
111
|
+
wct_description^8.5
|
112
|
+
url^15
|
113
|
+
content^5
|
114
|
+
host^5
|
117
115
|
</str>
|
118
116
|
<int name="ps">3</int>
|
119
117
|
<float name="tie">0.01</float>
|
data/template.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# We can remove `blacklight` and `blacklight_range_limit` once they are released
|
4
|
-
# since they are already dependents of
|
4
|
+
# since they are already dependents of Warclight (but we need to pin to particular branches)
|
5
5
|
gem 'blacklight', github: 'projectblacklight/blacklight'
|
6
6
|
gem 'blacklight_range_limit', github: 'projectblacklight/blacklight_range_limit', branch: 'blacklight-7'
|
7
7
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warclight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Ruest
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -213,7 +213,6 @@ files:
|
|
213
213
|
- Rakefile
|
214
214
|
- app/assets/images/blacklight/compact.svg
|
215
215
|
- app/assets/images/blacklight/logo.png
|
216
|
-
- app/assets/javascripts/warclight/oembed_viewer.js
|
217
216
|
- app/assets/javascripts/warclight/warclight.js
|
218
217
|
- app/assets/stylesheets/warclight/application.scss
|
219
218
|
- app/assets/stylesheets/warclight/warclight.scss
|
@@ -1,39 +0,0 @@
|
|
1
|
-
Blacklight.onLoad(function () {
|
2
|
-
'use strict';
|
3
|
-
var onlineContentTabSelector = '[data-arclight-online-content-tab="true"]';
|
4
|
-
var oEmbedViewerSelector = '[data-arclight-oembed="true"]';
|
5
|
-
|
6
|
-
$(onlineContentTabSelector).on('shown.bs.tab', function() {
|
7
|
-
var $viewerElements = $(oEmbedViewerSelector);
|
8
|
-
if($viewerElements.length === 0) {
|
9
|
-
return;
|
10
|
-
}
|
11
|
-
|
12
|
-
$viewerElements.each(function (i, element) {
|
13
|
-
var $el = $(element);
|
14
|
-
var data = $el.data();
|
15
|
-
var resourceUrl = data.arclightOembedUrl;
|
16
|
-
$.ajax({
|
17
|
-
url: resourceUrl,
|
18
|
-
dataType: 'html'
|
19
|
-
}).done(function (response) {
|
20
|
-
var links = $('<div>' + response.match(/<link .*>/g).join('') + '</div>'); // Parse out link elements so image assets are not loaded
|
21
|
-
var oEmbedEndPoint = links.find('link[rel="alternate"][type="application/json+oembed"]').prop('href');
|
22
|
-
|
23
|
-
if(!oEmbedEndPoint || oEmbedEndPoint.length === 0) {
|
24
|
-
return;
|
25
|
-
}
|
26
|
-
|
27
|
-
$.ajax({
|
28
|
-
url: oEmbedEndPoint
|
29
|
-
}).done(function (oEmbedResponse) {
|
30
|
-
if(oEmbedResponse.html) {
|
31
|
-
$el.hide()
|
32
|
-
.html(oEmbedResponse.html)
|
33
|
-
.fadeIn(500);
|
34
|
-
}
|
35
|
-
});
|
36
|
-
});
|
37
|
-
});
|
38
|
-
});
|
39
|
-
});
|