geoblacklight 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -3
  3. data/app/assets/javascripts/geoblacklight/geoblacklight.js +1 -1
  4. data/app/assets/javascripts/geoblacklight/modules/metadata.js +7 -0
  5. data/app/assets/javascripts/geoblacklight/modules/metadata_download_button.js +58 -0
  6. data/app/assets/javascripts/geoblacklight/modules/results.js +10 -15
  7. data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +3 -2
  8. data/app/assets/stylesheets/geoblacklight/modules/metadata.scss +27 -3
  9. data/app/assets/stylesheets/geoblacklight/modules/metadata_content.scss +38 -0
  10. data/app/assets/stylesheets/geoblacklight/modules/metadata_markup.scss +9 -0
  11. data/app/assets/stylesheets/geoblacklight/modules/metadata_missing.scss +7 -0
  12. data/app/helpers/geoblacklight_helper.rb +24 -0
  13. data/app/presenters/geoblacklight/document_presenter.rb +2 -1
  14. data/app/views/catalog/_metadata.html.erb +21 -6
  15. data/app/views/catalog/metadata/_content.html.erb +3 -0
  16. data/app/views/catalog/metadata/_markup.html.erb +8 -0
  17. data/app/views/catalog/metadata/_missing.html.erb +6 -0
  18. data/app/views/catalog/metadata.js.erb +8 -4
  19. data/config/locales/geoblacklight.en.yml +1 -0
  20. data/geoblacklight.gemspec +4 -1
  21. data/lib/generators/geoblacklight/templates/settings.yml +2 -2
  22. data/lib/geoblacklight/engine.rb +2 -1
  23. data/lib/geoblacklight/metadata/base.rb +88 -0
  24. data/lib/geoblacklight/metadata/fgdc.rb +14 -0
  25. data/lib/geoblacklight/metadata/iso19139.rb +14 -0
  26. data/lib/geoblacklight/metadata.rb +12 -31
  27. data/lib/geoblacklight/metadata_transformer/base.rb +49 -0
  28. data/lib/geoblacklight/metadata_transformer/fgdc.rb +16 -0
  29. data/lib/geoblacklight/metadata_transformer/iso19139.rb +16 -0
  30. data/lib/geoblacklight/metadata_transformer.rb +33 -0
  31. data/lib/geoblacklight/references.rb +14 -0
  32. data/lib/geoblacklight/version.rb +1 -1
  33. data/lib/geoblacklight/view_helper_override.rb +3 -2
  34. data/lib/geoblacklight.rb +7 -0
  35. data/spec/features/download_layer_spec.rb +5 -2
  36. data/spec/features/layer_inspection_spec.rb +1 -1
  37. data/spec/features/metadata_panel_spec.rb +15 -4
  38. data/spec/features/saved_searches_spec.rb +1 -1
  39. data/spec/features/split_view.html.erb_spec.rb +2 -2
  40. data/spec/fixtures/solr_documents/harvard_raster.json +2 -2
  41. data/spec/fixtures/solr_documents/public_iiif_princeton.json +1 -1
  42. data/spec/helpers/{geoblacklight_helpers_spec.rb → geoblacklight_helper_spec.rb} +54 -0
  43. data/spec/javascripts/geoblacklight_spec.js +4 -0
  44. data/spec/javascripts/metadata_download_button_spec.js +14 -0
  45. data/spec/lib/geoblacklight/metadata/base_spec.rb +85 -0
  46. data/spec/lib/geoblacklight/metadata_spec.rb +26 -18
  47. data/spec/lib/geoblacklight/metadata_transformer/base_spec.rb +35 -0
  48. data/spec/lib/geoblacklight/metadata_transformer/fgdc_spec.rb +23 -0
  49. data/spec/lib/geoblacklight/metadata_transformer/iso19139_spec.rb +23 -0
  50. data/spec/lib/geoblacklight/metadata_transformer_spec.rb +69 -0
  51. data/spec/lib/geoblacklight/references_spec.rb +12 -1
  52. data/spec/lib/geoblacklight/view_helper_override_spec.rb +1 -0
  53. data/spec/spec_helper.rb +11 -8
  54. data/spec/test_app_templates/lib/generators/test_app_generator.rb +2 -0
  55. data/spec/test_app_templates/metadata/fgdc.html +129 -0
  56. data/spec/test_app_templates/metadata/fgdc.xml +145 -0
  57. data/spec/test_app_templates/metadata/iso.html +275 -0
  58. data/spec/test_app_templates/metadata/iso.xml +511 -0
  59. data/spec/test_app_templates/solr_documents +1 -1
  60. metadata +83 -7
  61. data/app/assets/stylesheets/geoblacklight/modules/coderay.scss +0 -147
@@ -0,0 +1,69 @@
1
+ require 'spec_helper'
2
+
3
+ describe Geoblacklight::MetadataTransformer do
4
+ let(:klass) { instance_double(Class) }
5
+ before do
6
+ allow(metadata).to receive(:blank?).and_return(false)
7
+ allow(metadata).to receive(:class).and_return(klass)
8
+ end
9
+
10
+ describe '.instance' do
11
+ context 'with FGDC metadata' do
12
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Fgdc) }
13
+ subject do
14
+ described_class.instance(metadata)
15
+ end
16
+
17
+ before do
18
+ allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Fgdc')
19
+ end
20
+
21
+ it 'initializes a Fgdc Object' do
22
+ expect(subject).to be_a Geoblacklight::MetadataTransformer::Fgdc
23
+ end
24
+ end
25
+
26
+ context 'with ISO19139 metadata' do
27
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Iso19139) }
28
+ subject do
29
+ described_class.instance(metadata)
30
+ end
31
+
32
+ before do
33
+ allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Iso19139')
34
+ end
35
+
36
+ it 'initializes a Iso19139 Object' do
37
+ expect(subject).to be_a Geoblacklight::MetadataTransformer::Iso19139
38
+ end
39
+ end
40
+
41
+ context 'without a metadata type' do
42
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
43
+ subject do
44
+ described_class.instance(metadata)
45
+ end
46
+
47
+ before do
48
+ allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Base')
49
+ end
50
+
51
+ it 'defaults to the BaseTransformer Class' do
52
+ expect(subject).to be_a Geoblacklight::MetadataTransformer::Base
53
+ end
54
+ end
55
+
56
+ context 'with an invalid metadata type' do
57
+ let(:metadata) { instance_double(Geoblacklight::Metadata::Base) }
58
+
59
+ before do
60
+ allow(klass).to receive(:name).and_return('Geoblacklight::Metadata::Invalid')
61
+ end
62
+
63
+ it 'raises a TypeError' do
64
+ expect { described_class.instance(metadata) }.to \
65
+ raise_error Geoblacklight::MetadataTransformer::TypeError, /Metadata type .+ is not supported/
66
+ end
67
+ end
68
+ end
69
+ end
@@ -106,12 +106,23 @@ describe Geoblacklight::References do
106
106
  end
107
107
  end
108
108
  describe 'refs' do
109
- it 'is enumberable references' do
109
+ it 'is a set of enumberable references' do
110
110
  complex_shapefile.refs.each do |reference|
111
111
  expect(reference).to be_an Geoblacklight::Reference
112
112
  end
113
113
  end
114
114
  end
115
+ describe 'shown_metadata_refs' do
116
+ it 'is a set of metadata references exposed by the configuration' do
117
+ expect(complex_shapefile.shown_metadata_refs.count).to eq 2
118
+ end
119
+ end
120
+ describe 'shown_metadata' do
121
+ it 'is a set of metadata resources exposed by the configuration' do
122
+ expect(complex_shapefile.shown_metadata.count).to eq 2
123
+ expect(complex_shapefile.shown_metadata.first).to be_a Geoblacklight::Metadata::Base
124
+ end
125
+ end
115
126
  describe 'direct_download' do
116
127
  it 'returns the direct download link' do
117
128
  download = complex_shapefile.download
@@ -2,6 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Geoblacklight::ViewHelperOverride do
4
4
  class GeoblacklightControllerTestClass
5
+ include AbstractController::Translation
5
6
  attr_accessor :params
6
7
  end
7
8
 
data/spec/spec_helper.rb CHANGED
@@ -10,18 +10,21 @@ EngineCart.load_application!
10
10
  require 'rails-controller-testing' if Rails::VERSION::MAJOR >= 5
11
11
  require 'rspec/rails'
12
12
  require 'capybara/rspec'
13
- require 'capybara/poltergeist'
14
- Capybara.javascript_driver = :poltergeist
13
+ require 'selenium-webdriver'
15
14
 
16
- Capybara.register_driver :poltergeist do |app|
17
- options = {}
15
+ Capybara.register_driver(:headless_chrome) do |app|
16
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
17
+ chromeOptions: { args: %w(headless disable-gpu) }
18
+ )
18
19
 
19
- options[:timeout] = RUBY_PLATFORM == 'java' ? 120 : 15
20
-
21
- Capybara::Poltergeist::Driver.new(app, options)
20
+ Capybara::Selenium::Driver.new(app,
21
+ browser: :chrome,
22
+ desired_capabilities: capabilities)
22
23
  end
23
24
 
24
- Capybara.default_wait_time = 15
25
+ Capybara.javascript_driver = :headless_chrome
26
+
27
+ Capybara.default_max_wait_time = 15
25
28
 
26
29
  if ENV['COVERAGE'] || ENV['CI']
27
30
  require 'simplecov'
@@ -25,6 +25,8 @@ class TestAppGenerator < Rails::Generators::Base
25
25
  def fixtures
26
26
  FileUtils.mkdir_p 'spec/fixtures/solr_documents'
27
27
  directory 'solr_documents', 'spec/fixtures/solr_documents'
28
+ FileUtils.mkdir_p 'spec/fixtures/metadata'
29
+ directory 'metadata', 'spec/fixtures/metadata'
28
30
  end
29
31
 
30
32
  def install_teaspoon
@@ -0,0 +1,129 @@
1
+ <html>
2
+ <head>
3
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4
+ <title>Custom Link Sample</title>
5
+ </head>
6
+ <body>
7
+ <div class="metadata-container">
8
+ <h1>Custom Link Sample</h1>
9
+ <ul>
10
+ <li><a href="#fgdc-identification-info">Identification Information</a></li>
11
+ <li><a href="#fgdc-distribution-info">Distribution Information</a></li>
12
+ <li><a href="#fgdc-metadata-reference-info">Metadata Reference Information</a></li>
13
+ </ul>
14
+ <div id="fgdc-identification-info">
15
+ <dl><dt>Identification Information</dt>
16
+ <dd>
17
+ <dl><dt>Citation</dt>
18
+ <dd>
19
+ <dl><dt>Originator</dt>
20
+ <dd>Esri</dd><dt>Publication Date</dt>
21
+ <dd>20110608</dd><dt>Title</dt>
22
+ <dd>Custom Link Sample</dd><dt>Geospatial Data Presentation Form</dt>
23
+ <dd>tabular digital data</dd><dt>Publication Information</dt>
24
+ <dd>
25
+ <dl><dt>Publication Place</dt>
26
+ <dd>380 New York St., Redlands, CA, USA</dd><dt>Publisher</dt>
27
+ <dd>Esri</dd>
28
+ </dl>
29
+ </dd><dt>Online Linkage</dt>
30
+ <dd>http://www.esri.com</dd>
31
+ </dl>
32
+ </dd><dt>Abstract</dt>
33
+ <dd>This is a test metadata record for use in the Add a custom link to a search result web help topic. Note, the ftp URL here is just a sample and does not open an actual ftp site.
34
+ </dd><dt>Purpose</dt>
35
+ <dd>SAMPLE</dd><dt>Temporal Extent</dt>
36
+ <dd>
37
+ <dl><dt>Currentness Reference</dt>
38
+ <dd>ground condition</dd><dt>Time Period</dt>
39
+ <dd>
40
+ <dl><dt>Beginning</dt>
41
+ <dd>20110608</dd><dt>End</dt>
42
+ <dd>Present</dd>
43
+ </dl>
44
+ </dd>
45
+ </dl>
46
+ </dd><dt>Bounding Box</dt>
47
+ <dd>
48
+ <dl><dt>West</dt>
49
+ <dd>-96</dd><dt>East</dt>
50
+ <dd>-83</dd><dt>North</dt>
51
+ <dd>34</dd><dt>South</dt>
52
+ <dd>20</dd>
53
+ </dl>
54
+ </dd><dt>Theme Keyword</dt>
55
+ <dd>SAMPLE</dd>
56
+ <dd>
57
+ <dl><dt>Theme Keyword Thesaurus</dt>
58
+ <dd>None</dd>
59
+ </dl>
60
+ </dd><dt>ISO Topic Category</dt>
61
+ <dd>oceans</dd><dt>Place Keyword</dt><dt>Access Restrictions</dt>
62
+ <dd>None.</dd><dt>Use Restrictions</dt>
63
+ <dd>None.</dd><dt>Status</dt>
64
+ <dd>Complete</dd><dt>Maintenance and Update Frequency</dt>
65
+ <dd>None planned</dd><dt>Point of Contact</dt>
66
+ <dd>
67
+ <dl><dt>Contact Organization</dt>
68
+ <dd>Esri</dd><dt>Delivery Point</dt>
69
+ <dd>380 New York St.</dd><dt>City</dt>
70
+ <dd>Redlands</dd><dt>State</dt>
71
+ <dd>CA</dd><dt>Postal Code</dt>
72
+ <dd>92373</dd><dt>Country</dt>
73
+ <dd>UNITED STATES</dd>
74
+ </dl>
75
+ </dd>
76
+ </dl>
77
+ </dd>
78
+ </dl>
79
+ </div>
80
+ <div id="fgdc-distribution-info">
81
+ <dl><dt>Distribution Information</dt>
82
+ <dd>
83
+ <dl><dt>Format Name</dt>
84
+ <dd>Originator's Data Format(s)</dd><dt>Distributor</dt>
85
+ <dd>Esri</dd><dt>Online Access</dt>
86
+ <dd>ftp://ftp.sample.com</dd><dt>Name</dt>
87
+ <dd/>
88
+ </dl>
89
+ </dd>
90
+ </dl>
91
+ </div>
92
+ <div id="fgdc-metadata-reference-info">
93
+ <dl><dt>Metadata Reference Information</dt>
94
+ <dd>
95
+ <dl><dt>Metadata Date</dt>
96
+ <dd>20110608</dd><dt>Metadata Contact</dt>
97
+ <dd>
98
+ <dl><dt>Contact Information</dt>
99
+ <dd>
100
+ <dl><dt>Contact Organization Primary</dt>
101
+ <dd>
102
+ <dl><dt>Contact Organization</dt>
103
+ <dd>Esri</dd>
104
+ </dl>
105
+ </dd><dt>Contact Position</dt>
106
+ <dd>SDI Solutions</dd><dt>Contact Address</dt>
107
+ <dd>
108
+ <dl><dt>Address</dt>
109
+ <dd>380 New York St.</dd><dt>City</dt>
110
+ <dd>Redlands</dd><dt>State or Province</dt>
111
+ <dd>CA</dd><dt>Postal Code</dt>
112
+ <dd>92373</dd><dt>Country</dt>
113
+ <dd>USA</dd>
114
+ </dl>
115
+ </dd><dt>Contact Voice Telephone</dt>
116
+ <dd>909-793-2853</dd>
117
+ </dl>
118
+ </dd>
119
+ </dl>
120
+ </dd><dt>Metadata Standard Name</dt>
121
+ <dd>FGDC Content Standard for Digital Geospatial Metadata</dd><dt>Metadata Standard Version</dt>
122
+ <dd>FGDC-STD-001-1998</dd>
123
+ </dl>
124
+ </dd>
125
+ </dl>
126
+ </div>
127
+ </div>
128
+ </body>
129
+ </html>
@@ -0,0 +1,145 @@
1
+ <?xml version="1.0"?>
2
+ <metadata>
3
+ <idinfo>
4
+ <citation>
5
+ <citeinfo>
6
+ <origin>Esri</origin>
7
+ <pubdate>20110608</pubdate>
8
+ <title>Custom Link Sample</title>
9
+ <geoform>tabular digital data</geoform>
10
+ <pubinfo>
11
+ <pubplace>380 New York St., Redlands, CA, USA</pubplace>
12
+ <publish>Esri</publish>
13
+ </pubinfo>
14
+ <onlink>http://www.esri.com</onlink>
15
+ </citeinfo>
16
+ </citation>
17
+ <descript>
18
+ <abstract>This is a test metadata record for use in the Add a custom link to a search result
19
+ web help topic. Note, the ftp URL here is just a sample and does not open an actual ftp
20
+ site.</abstract>
21
+ <purpose>SAMPLE</purpose>
22
+ <supplinf>This does not represent an actual dataset</supplinf>
23
+ </descript>
24
+ <timeperd>
25
+ <timeinfo>
26
+ <rngdates>
27
+ <begdate>20110608</begdate>
28
+ <enddate>Present</enddate>
29
+ </rngdates>
30
+ </timeinfo>
31
+ <current>ground condition</current>
32
+ </timeperd>
33
+ <status>
34
+ <progress>Complete</progress>
35
+ <update>None planned</update>
36
+ </status>
37
+ <spdom>
38
+ <bounding>
39
+ <westbc>-96</westbc>
40
+ <eastbc>-83</eastbc>
41
+ <northbc>34</northbc>
42
+ <southbc>20</southbc>
43
+ </bounding>
44
+ </spdom>
45
+ <keywords>
46
+ <theme>
47
+ <themekt>None</themekt>
48
+ <themekey>SAMPLE</themekey>
49
+ </theme>
50
+ <theme>
51
+ <themekt>ISO 19115 Topic Category</themekt>
52
+ <themekey>oceans</themekey>
53
+ </theme>
54
+ </keywords>
55
+ <accconst>None.</accconst>
56
+ <useconst>None.</useconst>
57
+ <ptcontac>
58
+ <cntinfo>
59
+ <cntorgp>
60
+ <cntorg>Esri</cntorg>
61
+ <cntper>SDI Solutions Team</cntper>
62
+ </cntorgp>
63
+ <cntaddr>
64
+ <addrtype>mailing and physical</addrtype>
65
+ <address>380 New York St.</address>
66
+ <city>Redlands</city>
67
+ <state>CA</state>
68
+ <postal>92373</postal>
69
+ <country>UNITED STATES</country>
70
+ </cntaddr>
71
+ <cntvoice>909-793-2853</cntvoice>
72
+ </cntinfo>
73
+ </ptcontac>
74
+ </idinfo>
75
+ <distinfo>
76
+ <distrib>
77
+ <cntinfo>
78
+ <cntorgp>
79
+ <cntorg>Esri</cntorg>
80
+ </cntorgp>
81
+ <cntpos>Customer Service</cntpos>
82
+ <cntaddr>
83
+ <addrtype>mailing and physical</addrtype>
84
+ <address>380 New York St.</address>
85
+ <city>Redlands</city>
86
+ <state>CA</state>
87
+ <postal>92373</postal>
88
+ <country>USA</country>
89
+ </cntaddr>
90
+ <cntvoice>909-793-2853</cntvoice>
91
+ </cntinfo>
92
+ </distrib>
93
+ <resdesc>Downloadable Data</resdesc>
94
+ <distliab>None.</distliab>
95
+ <stdorder>
96
+ <digform>
97
+ <digtinfo>
98
+ <formname>Originator's Data Format(s)</formname>
99
+ </digtinfo>
100
+ <digtopt>
101
+ <onlinopt>
102
+ <computer>
103
+ <networka>
104
+ <networkr>ftp://ftp.sample.com</networkr>
105
+ </networka>
106
+ </computer>
107
+ <accinstr>None.</accinstr>
108
+ <oncomp>Standard Internet browser, PC, Mac, UNIX, Linux
109
+ systems</oncomp>
110
+ </onlinopt>
111
+ </digtopt>
112
+ </digform>
113
+ <fees>None.</fees>
114
+ </stdorder>
115
+ </distinfo>
116
+ <metainfo>
117
+ <metd>20110608</metd>
118
+ <metc>
119
+ <cntinfo>
120
+ <cntorgp>
121
+ <cntorg>Esri</cntorg>
122
+ </cntorgp>
123
+ <cntpos>SDI Solutions</cntpos>
124
+ <cntaddr>
125
+ <addrtype>mailing and physical</addrtype>
126
+ <address>380 New York St.</address>
127
+ <city>Redlands</city>
128
+ <state>CA</state>
129
+ <postal>92373</postal>
130
+ <country>USA</country>
131
+ </cntaddr>
132
+ <cntvoice>909-793-2853</cntvoice>
133
+ </cntinfo>
134
+ </metc>
135
+ <metstdn>FGDC Content Standard for Digital Geospatial Metadata</metstdn>
136
+ <metstdv>FGDC-STD-001-1998</metstdv>
137
+ <metac>None</metac>
138
+ <metuc>None</metuc>
139
+ <metsi>
140
+ <metscs>None</metscs>
141
+ <metsc>Unclassified</metsc>
142
+ <metshd>None</metshd>
143
+ </metsi>
144
+ </metainfo>
145
+ </metadata>