geoblacklight 0.0.6 → 0.0.7

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: 277065d1ccfa2b672a49c7274d3ff541045c26e4
4
- data.tar.gz: f73d1a5581fe9e9ec723b2d1f43f20319fa207d1
3
+ metadata.gz: 9eb92c283b222d30905b5012385f7a51bb3f303f
4
+ data.tar.gz: a7e10de6f63d7991d008cd01ff2f41d1b4b3c0c1
5
5
  SHA512:
6
- metadata.gz: 9adea08883883ad2e6b89d0af19888d5629bcf1eb8e89845462ee6657b314230a9419d796322ff01ec8e206a283655780d19bb47501eb725ce982d2189c42b98
7
- data.tar.gz: 30e75668c5cc73d53fa89603c8252b22f98796f9879f901da377c1d96126e479c50d7229ec66abdfe437e31b02135e7380778a719b52db29338cac62587ebd43
6
+ metadata.gz: 02ce6eef716f16b585772465b5678883bb23df710607d66327b57ea68e497b0165b2e26eebd74e0ace42836cc0024a09e1b15023e36e74ad12bc7764e544e4c6
7
+ data.tar.gz: 6edc12e20927c02d0800d1f4df2566406442792951cc8279ebe8124b4621c7859cb0d7383237a4b00f852dfddbd3adac0a0fc124137114eb2a37889feab4e49d
data/README.md CHANGED
@@ -60,9 +60,6 @@ Boot GeoBlacklight test app
60
60
  rake geoblacklight:solr:seed # to load sample documents into jetty Solr instance
61
61
  rails server
62
62
 
63
- Note that if you're using Rails with Spring enabled, we've found the the `rails generate` commands
64
- will stall. The workaround is to kill the spring daemon process. You will will probably not need to run this generator regularly.
65
-
66
63
  Run tests
67
64
 
68
65
  rake ci
@@ -1,9 +1,10 @@
1
1
  Blacklight.onLoad(function () {
2
2
  $('[data-map="home"]').each(function(i, element) {
3
3
  var geoblacklight = new GeoBlacklight(this),
4
+ data = $(this).data(),
4
5
  search;
5
6
  search = new L.Control.GeoSearch(function(querystring) {
6
- this.link.href = "/catalog?" + querystring;
7
+ this.link.href = data.catalogPath + '?' + querystring;
7
8
  }, { button: true });
8
9
  geoblacklight.map.addControl(search);
9
10
  });
@@ -14,34 +14,43 @@
14
14
  },
15
15
 
16
16
  onAdd: function(map) {
17
- var container = L.DomUtil.create('div', 'opacity-control'),
17
+ var container = L.DomUtil.create('div', 'opacity-control unselectable'),
18
+ controlArea = L.DomUtil.create('div', 'opacity-area', container),
18
19
  handle = L.DomUtil.create('div', 'opacity-handle', container),
19
- bottom = L.DomUtil.create('div', 'oppacity-bottom', container);
20
+ bottom = L.DomUtil.create('div', 'opacity-bottom', container);
20
21
 
21
22
  L.DomEvent.disableClickPropagation(container);
22
- this.setListeners(handle);
23
+ this.setListeners(handle, bottom);
24
+ handle.style.top = handle.offsetTop - 12 + 50 + 'px';
25
+ handle.innerHTML = parseInt(this.options.layer.options.opacity * 100) + '%';
23
26
  return container;
24
27
  },
25
28
 
26
- setListeners: function(handle) {
29
+ setListeners: function(handle, bottom) {
27
30
  var _this = this,
28
31
  start = false,
29
32
  startTop;
30
33
 
31
34
  L.DomEvent.addListener(document, 'mousemove', function(e) {
32
35
  if (!start) return;
33
- handle.style.top = Math.max(-5, Math.min(195, startTop + parseInt(e.clientY, 10) - start)) + 'px';
34
- _this.options.layer.setOpacity(1 - (handle.offsetTop / 200));
36
+ var percentInverse = Math.max(0, Math.min(200, startTop + parseInt(e.clientY, 10) - start)) / 2;
37
+ handle.style.top = ((percentInverse * 2) - 12) + 'px';
38
+ handle.innerHTML = Math.round((1 - (percentInverse / 100)) * 100) + '%';
39
+ bottom.style.height = Math.max(0, (((100 - percentInverse) * 2) - 12)) + 'px';
40
+ bottom.style.top = Math.min(200, (percentInverse * 2) + 12) + 'px';
41
+ _this.options.layer.setOpacity(1 - (percentInverse / 100));
35
42
  });
36
43
 
37
44
  L.DomEvent.addListener(handle, 'mousedown', function(e) {
45
+ L.DomEvent.disableClickPropagation(e);
38
46
  start = parseInt(e.clientY, 10);
39
- startTop = handle.offsetTop - 5;
47
+ startTop = handle.offsetTop - 12;
40
48
  return false;
41
49
  });
42
50
 
43
51
  L.DomEvent.addListener(document, 'mouseup', function(e) {
44
52
  L.DomEvent.stopPropagation(e);
53
+ L.DomEvent.disableClickPropagation(e);
45
54
  start = null;
46
55
  });
47
56
  }
@@ -1,9 +1,4 @@
1
1
  Blacklight.onLoad(function() {
2
- var dynamicSearcher;
3
-
4
- dynamicSearcher = GeoBlacklight.debounce(function(querystring) {
5
- History.pushState(null, null, "/catalog?" + querystring);
6
- }, 800);
7
2
 
8
3
  History.Adapter.bind(window, 'statechange', function() {
9
4
  var state = History.getState();
@@ -11,8 +6,14 @@ Blacklight.onLoad(function() {
11
6
  });
12
7
 
13
8
  $('[data-map="index"]').each(function() {
14
- var geoblacklight = new GeoBlacklight(this).setHoverListeners(),
15
- search = new L.Control.GeoSearch(dynamicSearcher);
9
+ var data = $(this).data(),
10
+ dynamicSearcher, geoblacklight, search;
11
+
12
+ dynamicSearcher = GeoBlacklight.debounce(function(querystring) {
13
+ History.pushState(null, null, data.catalogPath + '?' + querystring);
14
+ }, 800);
15
+ geoblacklight = new GeoBlacklight(this).setHoverListeners();
16
+ search = new L.Control.GeoSearch(dynamicSearcher);
16
17
  geoblacklight.map.addControl(search);
17
18
  });
18
19
 
@@ -1,3 +1,22 @@
1
1
  [data-map="home"] {
2
- height: 600px;
3
- }
2
+ height: 400px;
3
+ }
4
+
5
+ .home-search-area {
6
+ text-align: center;
7
+ }
8
+
9
+ .home-facet-label {
10
+ background: $gray-light;
11
+ border-radius: .25em;
12
+ color: #fff;
13
+ font-size: 1.4em;
14
+ line-height: 2em;
15
+ padding: .2em .6em .3em;
16
+ text-align: center;
17
+
18
+ &:hover {
19
+ color: #fff;
20
+ text-decoration: none;
21
+ }
22
+ }
@@ -1,34 +1,58 @@
1
1
  .leaflet-control.opacity-control {
2
- background: #fff;
3
- border: 1px solid #bbb;
4
- -webkit-border-radius: 3px;
5
- border-radius: 3px;
2
+ background-color: #a9acb1;
3
+ border-radius: 15px;
4
+ display: block;
6
5
  height: 200px;
7
- position: absolute;
8
- text-align: center;
9
- top: 120px;
10
- width: 28px;
11
- z-index: 999;
6
+ left: 10px;
7
+ position: relative;
8
+ top: 15px;
9
+ width: 5px;
12
10
 
13
11
  .opacity-handle {
14
- background: #000;
15
- height: 10px;
16
- left: -1px;
12
+ background-color: #fff;
13
+ border-radius: 100%;
14
+ cursor: ns-resize;
15
+ font-size: 10px;
16
+ height: 24px;
17
+ left: -10px;
18
+ line-height: 24px;
17
19
  position: absolute;
18
- top: 20px;
19
- width: 28px;
20
-
21
- &:hover {
22
- background: #444;
23
- cursor: pointer;
24
- cursor: ns-resize;
25
- }
20
+ text-align: center;
21
+ top: 0;
22
+ width: 24px;
23
+
24
+ -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
25
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
26
26
  }
27
27
 
28
28
  .opacity-bottom {
29
- bottom: 0;
30
- left: 8px;
29
+ background-color: #017afd;
30
+ border-radius: 15px;
31
+ display: block;
32
+ height: 138px;
33
+ left: 0px;
34
+ position: relative;
35
+ top: 62px;
36
+ width: 5px;
37
+ }
38
+
39
+ // Area underneath slider to prevent unintentioned map clicks
40
+ .opacity-area {
41
+ padding: 14px;
42
+ cursor: default;
43
+ height: 200px;
44
+ left: -12px;
31
45
  position: absolute;
32
- text-align: center;
46
+ top: 0px;
47
+ width: 20px;
33
48
  }
34
49
  }
50
+
51
+ .opacity-control.unselectable {
52
+ -webkit-touch-callout: none;
53
+ -webkit-user-select: none;
54
+ -khtml-user-select: none;
55
+ -moz-user-select: none;
56
+ -ms-user-select: none;
57
+ user-select: none;
58
+ }
@@ -47,6 +47,10 @@ module GeoblacklightHelper
47
47
  end
48
48
  end
49
49
 
50
+ def render_facet_tags(facet)
51
+ render_facet_limit(facets_from_request(facet).first, partial: 'facet_tag_item', layout: 'facet_tag_layout')
52
+ end
53
+
50
54
  def layer_type_image(type)
51
55
  content_tag :span, '', class: "geoblacklight-icon geoblacklight-#{type.downcase}"
52
56
  end
@@ -0,0 +1,3 @@
1
+ <% display_facet.items.each do |item| %>
2
+ <%= link_to item.value, catalog_index_path({f: {"#{facet_field.field}" => [item.value]}}), class: 'home-facet-label' %>
3
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -1,3 +1,18 @@
1
- <div id='row'>
2
- <%= content_tag :div, '', id: 'map', data: { map: 'home', 'catalog-path'=> catalog_index_path , 'map-bbox' => params[:bbox]} %>
1
+ <div class='jumbotron'>
2
+ <div class='home-search-area'>
3
+ <%= content_tag :h2, t('geoblacklight.home.headline') %>
4
+ <%= content_tag :h3, t('geoblacklight.home.search_heading') %>
5
+ <%= render_search_bar %>
6
+ </div>
7
+ </div>
8
+
9
+ <div class='row'>
10
+ <div class='col-md-6 text-center'>
11
+ <%= content_tag :h4, t('geoblacklight.home.category_heading') %>
12
+ <%= render_facet_tags [:dc_subject_sm] %>
13
+ </div>
14
+ <div class='col-md-6 text-center'>
15
+ <%= content_tag :h4, t('geoblacklight.home.map_heading') %>
16
+ <%= content_tag :div, '', id: 'map', data: { map: 'home', 'catalog-path'=> catalog_index_path , 'map-bbox' => params[:bbox]} %>
17
+ </div>
3
18
  </div>
@@ -16,7 +16,7 @@
16
16
  <div class='col-md-12 more-info-area'>
17
17
  <div class='collapse' data-collapse-target="<%= document['uuid'] %>">
18
18
  <small>
19
- <%= document['solr_year_i'] %>. <i><%= document['dc_creator_sm'].nil?? '' : document['dc_creator_sm'].join(', ') %></i>. <%= snippit(document['dc_description_s']) %>. <%= document['dc_publisher_s'] %>.%>
19
+ <%= document['solr_year_i'] %>. <i><%= document['dc_creator_sm'].nil?? '' : document['dc_creator_sm'].join(', ') %></i>. <%= snippit(document['dc_description_s']) %>. <%= document['dc_publisher_s'] %>.
20
20
  </small>
21
21
  </div>
22
22
  </div>
@@ -16,7 +16,7 @@
16
16
  <dd id="" itemprop="description"><%= abstract_truncator(document['dc_description_s']) %>&nbsp;</dd>
17
17
  <% unless document['dct_isPartOf_sm'].nil? %>
18
18
  <dt>Collection</dt>
19
- <dd itemprop="isPartOf"><%= document['dct_isPartOf_sm'].sort.join(', ') %>&nbsp;</dd>
19
+ <dd itemprop="isPartOf"><%= document['dct_isPartOf_sm'].sort.uniq.join(', ') %>&nbsp;</dd>
20
20
  <% end %>
21
21
  <% if document['dct_provenance_s'] == 'Stanford' and not document['dc_identifier_s'].nil? %>
22
22
  <dt>Citation</dt>
@@ -24,15 +24,15 @@
24
24
  <% end %>
25
25
  <% unless document['dct_spatial_sm'].nil? %>
26
26
  <dt>Places</dt>
27
- <dd itemprop="spatial"><%= document['dct_spatial_sm'].sort.join(', ') %>&nbsp;</dd>
27
+ <dd itemprop="spatial"><%= document['dct_spatial_sm'].sort.uniq.join(', ') %>&nbsp;</dd>
28
28
  <% end %>
29
29
  <% unless document['dc_subject_sm'].nil? %>
30
30
  <dt>Subjects</dt>
31
- <dd itemprop="keywords"><%= document['dc_subject_sm'].sort.join(', ') %>&nbsp;</dd>
31
+ <dd itemprop="keywords"><%= document['dc_subject_sm'].sort.uniq.join(', ') %>&nbsp;</dd>
32
32
  <% end %>
33
33
  <% unless document['dct_temporal_sm'].nil? %>
34
34
  <dt>Years</dt>
35
- <dd itemprop="temporal"><%= document['dct_temporal_sm'].sort.join(', ') %>&nbsp;</dd>
35
+ <dd itemprop="temporal"><%= document['dct_temporal_sm'].sort.uniq.join(', ') %>&nbsp;</dd>
36
36
  <% end %>
37
37
  </dl>
38
38
  </div>
@@ -0,0 +1,12 @@
1
+ <% unless has_search_parameters? %>
2
+ <%# if there are no input/search related params, display the "home" partial -%>
3
+ <%= render 'home' %>
4
+ <% else %>
5
+ <div id="sidebar" class="col-md-3 col-sm-4">
6
+ <%= render 'search_sidebar' %>
7
+ </div>
8
+
9
+ <div id="content" class="col-md-9 col-sm-8">
10
+ <%= render 'search_results' %>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <div id="header-navbar" class="navbar navbar-inverse navbar-static-top" role="navigation">
2
+ <div class="container">
3
+ <div class="navbar-header">
4
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#user-util-collapse">
5
+ <span class="sr-only">Toggle navigation</span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ </button>
10
+ <%= link_to application_name, root_path, class: "navbar-brand" %>
11
+ </div>
12
+
13
+ <div class="collapse navbar-collapse" id="user-util-collapse">
14
+ <%= render :partial=>'/user_util_links' %>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <% unless current_page?(root_url) %>
20
+ <div id="search-navbar" class="navbar navbar-default navbar-static-top" role="navigation">
21
+ <div class="container">
22
+ <%= render_search_bar %>
23
+ </div>
24
+ </div>
25
+ <% end %>
@@ -3,5 +3,10 @@ en:
3
3
  download:
4
4
  success: 'Your file %{title} is ready for download'
5
5
  error: 'Sorry, the requested file could not be downloaded'
6
+ home:
7
+ headline: 'Explore and discover...'
8
+ search_heading: 'Find the maps and data you need'
9
+ category_heading: 'Find by category'
10
+ map_heading: 'Find by location'
6
11
  tools:
7
12
  login_to_view: 'Login to view and download'
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -4,29 +4,24 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
4
4
  before do
5
5
  visit root_path
6
6
  end
7
- scenario 'should have facets listed correctly' do
8
- within '#facet-panel-collapse' do
9
- expect(page).to have_css('div.panel.facet_limit', text: 'Institution')
10
- expect(page).to have_css('div.panel.facet_limit', text: 'Publisher')
11
- expect(page).to have_css('div.panel.facet_limit', text: 'Subject')
12
- expect(page).to have_css('div.panel.facet_limit', text: 'Place')
13
- expect(page).to have_css('div.panel.facet_limit', text: 'Year')
14
- expect(page).to have_css('div.panel.facet_limit', text: 'Access')
15
- expect(page).to have_css('div.panel.facet_limit', text: 'Data type')
16
- expect(page).to have_css('div.panel.facet_limit', text: 'Format')
17
- expect(page).to have_css('div.panel.facet_limit', text: 'Language')
7
+ scenario 'search bar' do
8
+ expect(page).to_not have_css '#search-navbar'
9
+ within '.jumbotron' do
10
+ expect(page).to have_css 'h2', text: 'Explore and discover...'
11
+ expect(page).to have_css 'h3', text: 'Find the maps and data you need'
12
+ expect(page).to have_css 'form.search-query-form'
18
13
  end
19
- click_link 'Institution'
20
- expect(page).to have_css('a.facet_select', text: 'Harvard', visible: true)
21
- expect(page).to have_css('a.facet_select', text: 'Tufts', visible: true)
22
- expect(page).to have_css('a.facet_select', text: 'MIT', visible: true)
23
- expect(page).to have_css('a.facet_select', text: 'MassGIS', visible: true)
24
- expect(page).to have_css('a.facet_select', text: 'Stanford', visible: true)
14
+ end
15
+ scenario 'find by category' do
16
+ expect(page).to have_css '.home-facet-label', count: 7
17
+ click_link 'Census'
18
+ expect(page).to have_css '.filterName', text: 'Subject'
19
+ expect(page).to have_css '.filterValue', text: 'Census'
25
20
  end
26
21
  scenario 'map should be visible' do
27
- within '#content' do
22
+ within '#main-container' do
28
23
  expect(page).to have_css('#map')
29
- expect(page).to have_css('img.leaflet-tile', count: 16)
24
+ expect(page).to have_css('img.leaflet-tile', count: 4)
30
25
  end
31
26
  end
32
27
  scenario 'clicking map search should create a spatial search' do
@@ -37,13 +32,4 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
37
32
  end
38
33
  expect(page).to have_css '#documents'
39
34
  end
40
-
41
- scenario 'clicking map search should retain current search parameters' do
42
- visit '/?f[dc_subject_sm][]=polygon&f[dc_subject_sm][]=boundaries'
43
- find('#map').double_click
44
- within '#appliedParams' do
45
- expect(page).to have_content('Subject polygon')
46
- expect(page).to have_content('Subject boundaries')
47
- end
48
- end
49
35
  end
@@ -2,17 +2,39 @@ require 'spec_helper'
2
2
 
3
3
  feature 'Index view', js: true do
4
4
  before do
5
- visit catalog_index_path( f: { dct_provenance_s: ['Stanford']})
5
+ visit catalog_index_path(q: '*')
6
6
  end
7
7
 
8
8
  scenario 'should have documents and map on page' do
9
+ visit catalog_index_path(f: { dct_provenance_s: ['Stanford']})
9
10
  expect(page).to have_css('#documents')
10
11
  expect(page).to have_css(".document", count: 2)
11
12
  expect(page).to have_css('#map')
12
13
  end
13
14
 
15
+ scenario 'should have facets listed correctly' do
16
+ within '#facet-panel-collapse' do
17
+ expect(page).to have_css('div.panel.facet_limit', text: 'Institution')
18
+ expect(page).to have_css('div.panel.facet_limit', text: 'Publisher')
19
+ expect(page).to have_css('div.panel.facet_limit', text: 'Subject')
20
+ expect(page).to have_css('div.panel.facet_limit', text: 'Place')
21
+ expect(page).to have_css('div.panel.facet_limit', text: 'Year')
22
+ expect(page).to have_css('div.panel.facet_limit', text: 'Access')
23
+ expect(page).to have_css('div.panel.facet_limit', text: 'Data type')
24
+ expect(page).to have_css('div.panel.facet_limit', text: 'Format')
25
+ expect(page).to have_css('div.panel.facet_limit', text: 'Language')
26
+ end
27
+ click_link 'Institution'
28
+ expect(page).to have_css('a.facet_select', text: 'Harvard', visible: true)
29
+ expect(page).to have_css('a.facet_select', text: 'Tufts', visible: true)
30
+ expect(page).to have_css('a.facet_select', text: 'MIT', visible: true)
31
+ expect(page).to have_css('a.facet_select', text: 'MassGIS', visible: true)
32
+ expect(page).to have_css('a.facet_select', text: 'Stanford', visible: true)
33
+ end
34
+
14
35
  scenario 'hover on record should produce bounding box on map' do
15
36
  # Needed to find an svg element on the page
37
+ visit catalog_index_path(f: { dct_provenance_s: ['Stanford']})
16
38
  expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 0
17
39
  find('.documentHeader', match: :first).trigger(:mouseover)
18
40
  expect(Nokogiri::HTML.parse(page.body).css('path').length).to eq 1
@@ -32,4 +54,12 @@ feature 'Index view', js: true do
32
54
  expect(find('.page_entries')).to have_content('1 - 10')
33
55
  end
34
56
 
57
+ scenario 'clicking map search should retain current search parameters' do
58
+ visit '/?f[dc_subject_sm][]=polygon&f[dc_subject_sm][]=boundaries'
59
+ find('#map').double_click
60
+ within '#appliedParams' do
61
+ expect(page).to have_content('Subject polygon')
62
+ expect(page).to have_content('Subject boundaries')
63
+ end
64
+ end
35
65
  end
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.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Hardy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-14 00:00:00.000000000 Z
12
+ date: 2014-11-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: blacklight
@@ -267,7 +267,6 @@ files:
267
267
  - app/assets/javascripts/geoblacklight/modules/home.js
268
268
  - app/assets/javascripts/geoblacklight/modules/item.js
269
269
  - app/assets/javascripts/geoblacklight/modules/layer_opacity.js
270
- - app/assets/javascripts/geoblacklight/modules/map-view.js
271
270
  - app/assets/javascripts/geoblacklight/modules/results.js
272
271
  - app/assets/stylesheets/geoblacklight/_geoblacklight.css.scss
273
272
  - app/assets/stylesheets/geoblacklight/_styles.css.scss
@@ -282,12 +281,16 @@ files:
282
281
  - app/controllers/wms_controller.rb
283
282
  - app/helpers/geoblacklight_helper.rb
284
283
  - app/views/catalog/_document_split.html.erb
284
+ - app/views/catalog/_facet_tag_item.html.erb
285
+ - app/views/catalog/_facet_tag_layout.html.erb
285
286
  - app/views/catalog/_home_text.html.erb
286
287
  - app/views/catalog/_index_split_default.html.erb
287
288
  - app/views/catalog/_show_default.html.erb
288
289
  - app/views/catalog/_show_header_default.html.erb
289
290
  - app/views/catalog/_show_sidebar.html.erb
290
291
  - app/views/catalog/_upper_metadata.html.erb
292
+ - app/views/catalog/index.html.erb
293
+ - app/views/shared/_header_navbar.html.erb
291
294
  - config/initializers/rails_config.rb
292
295
  - config/jetty.yml
293
296
  - config/locales/geoblacklight.en.yml
@@ -304,7 +307,6 @@ files:
304
307
  - lib/geoblacklight/download/kmz_download.rb
305
308
  - lib/geoblacklight/download/shapefile_download.rb
306
309
  - lib/geoblacklight/engine.rb
307
- - lib/geoblacklight/fixtures_indexer.rb
308
310
  - lib/geoblacklight/solr_document.rb
309
311
  - lib/geoblacklight/version.rb
310
312
  - lib/geoblacklight/view_helper_override.rb
@@ -318,7 +320,6 @@ files:
318
320
  - spec/features/layer_inspection_spec.rb
319
321
  - spec/features/layer_preview_spec.rb
320
322
  - spec/features/split_view.html.erb_spec.rb
321
- - spec/fixtures/test-berkeley-fields.json
322
323
  - spec/lib/geoblacklight/controller_override_spec.rb
323
324
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
324
325
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
@@ -367,7 +368,6 @@ test_files:
367
368
  - spec/features/layer_inspection_spec.rb
368
369
  - spec/features/layer_preview_spec.rb
369
370
  - spec/features/split_view.html.erb_spec.rb
370
- - spec/fixtures/test-berkeley-fields.json
371
371
  - spec/lib/geoblacklight/controller_override_spec.rb
372
372
  - spec/lib/geoblacklight/download/kmz_download_spec.rb
373
373
  - spec/lib/geoblacklight/download/shapefile_download_spec.rb
@@ -1,211 +0,0 @@
1
- "use strict";
2
-
3
- // console.log('DEBUG: Inside geoblacklight/modules/map-view.js');
4
- Blacklight.onLoad(function () {
5
- // $('#geoblacklight-map-view').geoBlacklight_setupMapView();
6
- // $('#geoblacklight-tools').geoBlacklight_setupTools();
7
- });
8
-
9
- /* Requires leaflet */
10
- (function( $, document ) {
11
- var map, wmsLayer, spinner, mapBbox, alertMsg, layerBbox;
12
-
13
- function WktBboxToJson(solrDoc){
14
- return [[solrDoc.solr_sw_pt_0_d, solrDoc.solr_sw_pt_1_d],
15
- [solrDoc.solr_ne_pt_0_d, solrDoc.solr_sw_pt_1_d],
16
- [solrDoc.solr_ne_pt_0_d, solrDoc.solr_ne_pt_1_d],
17
- [solrDoc.solr_sw_pt_0_d, solrDoc.solr_ne_pt_1_d]];
18
- }
19
-
20
- $.fn.geoBlacklight_setupMapView = function (options){
21
- return this.each(function () {
22
- console.log(this)
23
- map = L.map('map');
24
- // console.log(solrDoc)
25
- // var layerBbox;
26
- // var location = JSON.parse(doc.Location);
27
- if (solrDoc.solr_bbox){
28
- layerBbox = WktBboxToJson(solrDoc);
29
- map.fitBounds([[solrDoc.solr_sw_pt_0_d, solrDoc.solr_sw_pt_1_d],
30
- [solrDoc.solr_ne_pt_0_d, solrDoc.solr_ne_pt_1_d]]);
31
- }
32
-
33
- var basemap = L.tileLayer('http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
34
- attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">',
35
- maxZoom: 18,
36
- subdomains: '1234' // see http://developer.mapquest.com/web/products/open/map
37
- }).addTo(map);
38
-
39
- map.on('click', function(e){
40
- spinner = "<span id='attribute-table' class=''><i class='fa fa-spinner fa-spin fa-3x fa-align-center'></i></span>"
41
- $("#attribute-table").replaceWith(spinner);
42
- // console.log(e)
43
- mapBbox = map.getBounds()
44
- var wmsoptions = {
45
- "URL": solrDoc.solr_wms_url,
46
- "SERVICE": "WMS",
47
- "VERSION": "1.1.1",
48
- "REQUEST": "GetFeatureInfo",
49
- "LAYERS": solrDoc.layer_id_s,
50
- "STYLES": "",
51
- "SRS": "EPSG:4326", /* XXX: is this the correct projection? */
52
- "BBOX": mapBbox._southWest.lng + "," + mapBbox._southWest.lat + "," + mapBbox._northEast.lng + "," + mapBbox._northEast.lat,
53
- "WIDTH": $("#map").width(),
54
- "HEIGHT": $("#map").height(),
55
- "QUERY_LAYERS": solrDoc.layer_id_s,
56
- "X": Math.round(e.containerPoint.x),
57
- "Y": Math.round(e.containerPoint.y),
58
- "EXCEPTIONS": "application/json",
59
- "info_format": "application/json"
60
- }
61
- console.log(e);
62
-
63
- $.ajax({
64
- type: 'POST',
65
- url: '/wms/handle',
66
- data: wmsoptions,
67
- success: function(data){
68
- console.log(data)
69
- if ('gis_service' in data){
70
- console.log(data);
71
- return;
72
- }
73
- var t = $("<table id='attribute-table' class='table table-hover table-condensed table-responsive table-striped table-bordered'><thead><tr class=''><th>Attribute</th><th>Value</th></tr></thead><tbody>")
74
- $.each(data.values, function(i,val){
75
- t.append("<tr><td>" + val[0] + "</td><td>" + val[1] + "</tr>")
76
- });
77
- $('#attribute-table').replaceWith(t);
78
- },
79
- fail: function(error){
80
- console.log(error);
81
- }
82
- });
83
- });
84
-
85
- if (solrDoc.solr_wms_url && solrDoc.layer_id_s &&
86
- (solrDoc.dc_rights_s == 'Public' || solrDoc.dct_provenance_s == 'Stanford')){
87
- wmsLayer = L.tileLayer.wms(solrDoc.solr_wms_url, {
88
- layers: solrDoc.layer_id_s,
89
- format: 'image/png',
90
- transparent: true, //so this seems to work for Stanford and Harvard
91
- tiled: true,
92
- CRS: "EPSG:900913",
93
- opacity: 0.75
94
- }).addTo(map);
95
- }else{
96
- L.polygon(layerBbox).addTo(map);
97
- $("#control").hide();
98
- }
99
- initHandle(wmsLayer);
100
-
101
- })
102
-
103
- }
104
-
105
-
106
- function initHandle(wmsLayer) {
107
- //MapBox Opacity Control
108
- var handle = document.getElementById('handle'),
109
- start = false,
110
- startTop;
111
-
112
- document.onmousemove = function(e) {
113
- if (!start) return;
114
- // Adjust control
115
- handle.style.top = Math.max(-5, Math.min(195, startTop + parseInt(e.clientY, 10) - start)) + 'px';
116
- // Adjust opacity
117
- wmsLayer.setOpacity(1 - (handle.offsetTop / 200));
118
- };
119
-
120
- if (handle) {
121
- handle.onmousedown = function(e) {
122
- // Record initial positions
123
- start = parseInt(e.clientY, 10);
124
- startTop = handle.offsetTop - 5;
125
- return false;
126
- };
127
-
128
- }
129
-
130
- document.onmouseup = function(e) {
131
- start = null;
132
- };
133
-
134
- }
135
-
136
- })( jQuery, document );
137
-
138
- (function ( $, document ) {
139
- $.fn.geoBlacklight_setupTools = function() {
140
- return this.each(function () {
141
- $(document).ready(function(){
142
- //See full abstract
143
- $('#more-abstract').on('click', function(){
144
- $('#abstract-trunc').toggle();
145
- $('#abstract-full').removeClass('hidden');
146
- });
147
-
148
- //Fire download shapefile REQUEST
149
- $('#download-shapefile').on('click', function(){
150
- $('#download-shapefile').addClass('disabled');
151
- $('#icon-shapefile').removeClass('fa-download');
152
- $('#icon-shapefile').addClass('fa-spinner fa-spin');
153
- $.ajax({
154
- type: 'POST',
155
- url: '/download/shapefile',
156
- data: solrDoc,
157
- }).done(function(data){
158
- var alertMsg;
159
- $('#download-shapefile').removeClass('disabled');
160
- $('#icon-shapefile').removeClass('fa-spinner fa-spin');
161
- $('#icon-shapefile').addClass('fa-download');
162
- console.log(data);
163
- if ('error' in data){
164
- console.log('something bad');
165
- alertMsg = "<div class='alert alert-danger fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Holy guacamole!</strong> Something went wrong with the download :(</div>";
166
- }else{
167
- alertMsg = "<div class='alert alert-success fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Good to go!</strong> Your file is <a href='/download/file?q=" + data.data + "'>ready to download.</a></div>";
168
- }
169
- $("#main-flashes").append(alertMsg);
170
- }).fail(function(data){
171
- var alertMsg = "<div class='alert alert-danger fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Holy guacamole!</strong> Something went wrong with the download :(</div>";
172
- $("#main-flashes").append(alertMsg);
173
- $('#icon-shapefile').removeClass('fa-spinner fa-spin');
174
- $('#icon-shapefile').addClass('fa-download');
175
-
176
- });
177
- });
178
-
179
- $('#download-kml').on('click', function(){
180
- $('#download-kml').addClass('disabled');
181
- $('#icon-kml').removeClass('fa-download');
182
- $('#icon-kml').addClass('fa-spinner fa-spin');
183
- $.ajax({
184
- type: 'POST',
185
- url: '/download/kml',
186
- data: solrDoc,
187
- }).done(function(data){
188
- var alertMsg;
189
- $('#download-kml').removeClass('disabled');
190
- $('#icon-kml').removeClass('fa-spinner fa-spin');
191
- $('#icon-kml').addClass('fa-download');
192
- console.log(data);
193
- if ('error' in data){
194
- console.log('something bad');
195
- alertMsg = "<div class='alert alert-danger fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Holy guacamole!</strong> Something went wrong with the download :(</div>";
196
- }else{
197
- alertMsg = "<div class='alert alert-success fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Good to go!</strong> Your file is <a href='/download/file?q=" + data.data + "'>ready to download.</a></div>";
198
- }
199
- $("#main-flashes").append(alertMsg);
200
- }).fail(function(data){
201
- var alertMsg = "<div class='alert alert-danger fade in'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button><strong>Holy guacamole!</strong> Something went wrong with the download :(</div>";
202
- $("#main-flashes").append(alertMsg);
203
- $('#icon-kml').removeClass('fa-spinner fa-spin');
204
- $('#icon-kml').addClass('fa-download');
205
- });
206
- });
207
- });
208
-
209
- })
210
- }
211
- })( jQuery, document );
@@ -1,34 +0,0 @@
1
- require "#{Rails.root}/spec/fixtures/geoblacklight_schema"
2
-
3
- class FixturesIndexer
4
- def self.run
5
- FixturesIndexer.new.run
6
- end
7
- def initialize
8
- @solr = Blacklight.solr
9
- end
10
- def run
11
- index
12
- commit
13
- end
14
- def fixtures
15
- @fixtures ||= JSON::parse(File.read("#{Rails.root}/spec/fixtures/geoblacklight_schema/transformed.json"))
16
- # @fixtures ||= file_list.map do |file|
17
- # fixture_template = ERB.new(File.read(file))
18
- # rendered_template = fixture_template.result(binding)
19
- # YAML::load rendered_template
20
- # end
21
- end
22
- def file_list
23
- # data = JSON::parse(File.read("#{Rails.root}/spec/fixtures/geoblacklight_schema/transformed.json"))
24
- # @file_list ||= Dir["#{Rails.root}/spec/fixtures/solr_documents/*.yml"]
25
- end
26
-
27
- private
28
- def index
29
- @solr.add fixtures
30
- end
31
- def commit
32
- @solr.commit
33
- end
34
- end
@@ -1,44 +0,0 @@
1
- [
2
- {
3
- "uuid": "http://ark.cdlib.org/ark:/28722/bk0012h5z5n",
4
- "dc_description_s": "Field boundaries for Napa County.",
5
- "dc_format_s": "Shapefile",
6
- "dc_identifier_s": "http://ark.cdlib.org/ark:/28722/bk0012h5z5n",
7
- "dc_language_s": "English",
8
- "dc_publisher_s": "UC Berkeley Libraries",
9
- "dc_rights_s": "Public",
10
- "dc_subject_sm": [
11
- "boundaries",
12
- "farming"
13
- ],
14
- "dc_title_s": "Field Boundaries",
15
- "dc_type_s": "Dataset",
16
- "dct_references_s": "{\"http://www.opengis.net/def/serviceType/ogc/wfs\":\"http://gis.lib.berkeley.edu:8080/geoserver/wfs\",\"http://www.opengis.net/def/serviceType/ogc/wms\":\"http://gis.lib.berkeley.edu:8080/geoserver/wms\"}",
17
- "dct_spatial_sm": [
18
- "Napa County",
19
- "American Canyon",
20
- "Yountville",
21
- "St Helena",
22
- "Calistoga"
23
- ],
24
- "dct_temporal_sm": [
25
- "2007"
26
- ],
27
- "dct_issued_s": "2000",
28
- "dct_provenance_s": "Berkeley",
29
- "georss_box_s": "38.157173 -122.647473 38.861126 -122.084131",
30
- "georss_polygon_s": "38.861126 -122.647473 38.861126 -122.084131 38.157173 -122.084131 38.157173 -122.647473 38.861126 -122.647473",
31
- "layer_slug_s": "berkeley-fields",
32
- "layer_id_s": "UCB:fields",
33
- "layer_geom_type_s": "Polygon",
34
- "layer_modified_dt": "2014-05-27T18:09:33Z",
35
- "solr_bbox": "-122.647473 38.157173 -122.084131 38.861126",
36
- "solr_ne_pt": "38.861126,-122.084131",
37
- "solr_sw_pt": "38.157173,-122.647473",
38
- "solr_geom": "ENVELOPE(-122.647473, -122.084131, 38.861126, 38.157173)",
39
- "solr_year_i": 2007,
40
- "solr_issued_dt": "2000-01-01T00:00:00Z",
41
- "solr_wms_url": "http://gis.lib.berkeley.edu:8080/geoserver/wms",
42
- "solr_wfs_url": "http://gis.lib.berkeley.edu:8080/geoserver/wfs"
43
- }
44
- ]