geoblacklight 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2569474d1cd7946363ce5ba8be7d783145007c9f
4
- data.tar.gz: dfb2e56fe8bc2302698a2192fd7a7bedac2c442d
3
+ metadata.gz: bffcde6f01bb25c38878c4c4643912723d2c8b4a
4
+ data.tar.gz: ba83d359a86f42f7ed8c558db32a7f2a36fb0b57
5
5
  SHA512:
6
- metadata.gz: 5093d1b9eda7a53ef3b64c5a22f2bf02bdde068e904234471d4c5a2c68c23c934f743d827ac304ff340a8b46a0a6a759b5b6bffcd440ed1def990b6758b1ec13
7
- data.tar.gz: 02d642f50886e7b86dd96999840f58ba91f787f217403f15e79baf4585b15d3788ccf3b79b30f7509a4673e08beed001d32e3f88ef540c2b4ee2e18fb9b6a80d
6
+ metadata.gz: c5ce60b374a179e08b712b54a212ccda9c6076dcfb10440aa8055edfe90534de27de88b93f1e9677f4e67bd2b032608b0b991eecf645291b4d7b1421044219b6
7
+ data.tar.gz: c42ef4e4c98c0a8b66e55dd10eb1400079b96ee99a35f1973e9abf10ce21e64e437262dbc4c69b5569a61a31161710169cb334a9e5e824bdf36baf6068185ed3
@@ -22,6 +22,9 @@ GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({
22
22
  overlay: L.layerGroup(),
23
23
 
24
24
  load: function() {
25
+ if (this.data.mapBbox) {
26
+ this.options.bbox = L.bboxToBounds(this.data.mapBbox);
27
+ }
25
28
  this.map = L.map(this.element).fitBounds(this.options.bbox);
26
29
  this.map.addLayer(this.basemap);
27
30
  this.map.addLayer(this.overlay);
@@ -41,7 +41,7 @@ module GeoblacklightHelper
41
41
  end
42
42
 
43
43
  def layer_type_image(type)
44
- content_tag :span, '', class: "geoblacklight-icon geoblacklight-#{type.downcase}"
44
+ content_tag :span, '', class: "geoblacklight-icon geoblacklight-#{type.downcase.gsub(' ', '-')}"
45
45
  end
46
46
 
47
47
  def layer_institution_image(institution)
@@ -66,4 +66,18 @@ module GeoblacklightHelper
66
66
  def render_facet_links(facet, items)
67
67
  items.uniq.map { |item| link_to item, catalog_index_path(f: { "#{facet}" => [item] }) }.join(', ').html_safe
68
68
  end
69
+
70
+ ##
71
+ # Looks up properly formatted names for formats
72
+ #
73
+ def proper_case_format(format)
74
+ I18n.t "geoblacklight.formats.#{format.downcase}"
75
+ end
76
+
77
+ ##
78
+ # Wraps download text with proper_case_format
79
+ #
80
+ def download_text(format)
81
+ "#{I18n.t 'geoblacklight.download.download'} #{proper_case_format(format)}".html_safe
82
+ end
69
83
  end
@@ -21,9 +21,9 @@
21
21
  <% if document_downloadable? %>
22
22
  <div class='btn-group' itemprop='distribution' itemscope='itemscope' itemtype='http://schema.org/DataDownload'>
23
23
  <% unless document.direct_download.blank? %>
24
- <%= link_to("Download #{@document[:dc_format_s]}", document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download]) %>
24
+ <%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download]) %>
25
25
  <% else %>
26
- <%= link_to("Download #{document.download_types.first[0].capitalize}", '', data: { download_path: "#{download_path(document[:layer_slug_s], type: document.download_types.first[0])}"}, class: 'btn btn-default') %>
26
+ <%= link_to(download_text(document.download_types.first[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: document.download_types.first[0])}"}, class: 'btn btn-default') %>
27
27
  <% end %>
28
28
  <button type='button' class='btn btn-default dropdown-toggle download-dropdown-toggle' data-toggle='dropdown' aria-expanded='false'>
29
29
  <span class='caret'></span>
@@ -33,14 +33,14 @@
33
33
  <% unless document.direct_download.blank? %>
34
34
  <li role="presentation" class="dropdown-header">Original</li>
35
35
  <li>
36
- <%= link_to("Download #{@document[:dc_format_s]}", document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
36
+ <%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
37
37
  </li>
38
38
  <% end %>
39
39
  <% if document.download_types.present? %>
40
40
  <li role="presentation" class="dropdown-header">Generated</li>
41
41
  <% document.download_types.each do |type| %>
42
42
  <%= content_tag(:li) do %>
43
- <% link_to("Download #{type[0].capitalize}", '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
43
+ <% link_to(download_text(type[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
44
44
  <% end %>
45
45
  <% end %>
46
46
  <% end %>
@@ -1,6 +1,7 @@
1
1
  en:
2
2
  geoblacklight:
3
3
  download:
4
+ download: 'Download'
4
5
  success: 'Your file %{title} is ready for download'
5
6
  error: 'Sorry, the requested file could not be downloaded'
6
7
  home:
@@ -9,4 +10,10 @@ en:
9
10
  category_heading: 'Find by...'
10
11
  map_heading: 'Find by location'
11
12
  tools:
12
- login_to_view: 'Login to view and download'
13
+ login_to_view: 'Login to view and download'
14
+ formats:
15
+ arcgrid: 'ArcGRID'
16
+ geojson: 'GeoJSON'
17
+ geotiff: 'GeoTIFF'
18
+ kmz: 'KMZ'
19
+ shapefile: 'Shapefile'
@@ -5,7 +5,7 @@ module Geoblacklight
5
5
  end
6
6
 
7
7
  def viewer_protocol
8
- return 'leaflet' if viewer_preference.nil?
8
+ return 'map' if viewer_preference.nil?
9
9
  viewer_preference.keys.first.to_s
10
10
  end
11
11
 
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -11,14 +11,14 @@ feature 'Download layer' do
11
11
  expect_any_instance_of(KmzDownload).to receive(:get).and_return('mit-us-ma-e25zcta5dct-2000-kmz.kmz')
12
12
  visit catalog_path('mit-us-ma-e25zcta5dct-2000')
13
13
  find('button.download-dropdown-toggle').click
14
- find('a', text: 'Download Kmz').click
14
+ find('a', text: 'Download KMZ').click
15
15
  expect(page).to have_css('a', text: 'Your file mit-us-ma-e25zcta5dct-2000-kmz.kmz is ready for download')
16
16
  end
17
17
  scenario 'options should be available under toggle' do
18
18
  visit catalog_path('mit-us-ma-e25zcta5dct-2000')
19
19
  find('button.download-dropdown-toggle').click
20
20
  expect(page).to have_css('li a', text: 'Download Shapefile')
21
- expect(page).to have_css('li a', text: 'Download Kmz')
21
+ expect(page).to have_css('li a', text: 'Download KMZ')
22
22
  end
23
23
  scenario 'restricted layer should not have download available to non logged in user' do
24
24
  visit catalog_path('stanford-jf841ys4828')
@@ -40,6 +40,6 @@ feature 'Download layer' do
40
40
  expect(page).to have_css 'li.dropdown-header', text: 'Original'
41
41
  expect(page).to have_css 'li.dropdown-header', text: 'Generated'
42
42
  expect(page).to have_css 'li a', text: 'Download Shapefile'
43
- expect(page).to have_css 'li a', text: 'Download Kmz'
43
+ expect(page).to have_css 'li a', text: 'Download KMZ'
44
44
  end
45
45
  end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'iiif reference' do
4
+ scenario 'displays leaflet viewer', js: true do
5
+ visit catalog_path('princeton-02870w62c')
6
+ expect(page).to have_css '.leaflet-control-zoom', visible: true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'layer with no wms or iiif' do
4
+ scenario 'has map with bounding box' do
5
+ pending 'waiting on #201, need example metadata record'
6
+ fail
7
+ end
8
+ end
@@ -13,4 +13,23 @@ describe GeoblacklightHelper do
13
13
  expect(html).to have_css 'a', text: 'Science', count: 1
14
14
  end
15
15
  end
16
+
17
+ describe '#layer_type_image' do
18
+ it 'lowercases and subs spaces for hyphens' do
19
+ html = Capybara.string(layer_type_image('TEst 123'))
20
+ expect(html).to have_css '.geoblacklight-test-123'
21
+ end
22
+ end
23
+
24
+ describe '#proper_case_format' do
25
+ it 'returns a properly cased format' do
26
+ expect(proper_case_format('GEOJSON')).to eq 'GeoJSON'
27
+ end
28
+ end
29
+
30
+ describe '#download_text' do
31
+ it 'returns download text concatenated with proper case format' do
32
+ expect(download_text('GEOJSON')).to eq 'Download GeoJSON'
33
+ end
34
+ end
16
35
  end
@@ -122,7 +122,7 @@ describe Geoblacklight::SolrDocument do
122
122
  end
123
123
  let(:document_attributes) { {} }
124
124
  it 'returns leaflet protocol' do
125
- expect(document.viewer_protocol).to eq 'leaflet'
125
+ expect(document.viewer_protocol).to eq 'map'
126
126
  end
127
127
  end
128
128
  describe 'viewer_endpoint' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -337,8 +337,10 @@ files:
337
337
  - spec/features/dct_references_spec.rb
338
338
  - spec/features/download_layer_spec.rb
339
339
  - spec/features/home_page_spec.rb
340
+ - spec/features/iiif_viewer_spec.rb
340
341
  - spec/features/layer_inspection_spec.rb
341
342
  - spec/features/layer_preview_spec.rb
343
+ - spec/features/layer_with_no_references_spec.rb
342
344
  - spec/features/saved_searches_spec.rb
343
345
  - spec/features/search_bar_spec.rb
344
346
  - spec/features/split_view.html.erb_spec.rb
@@ -404,8 +406,10 @@ test_files:
404
406
  - spec/features/dct_references_spec.rb
405
407
  - spec/features/download_layer_spec.rb
406
408
  - spec/features/home_page_spec.rb
409
+ - spec/features/iiif_viewer_spec.rb
407
410
  - spec/features/layer_inspection_spec.rb
408
411
  - spec/features/layer_preview_spec.rb
412
+ - spec/features/layer_with_no_references_spec.rb
409
413
  - spec/features/saved_searches_spec.rb
410
414
  - spec/features/search_bar_spec.rb
411
415
  - spec/features/split_view.html.erb_spec.rb