geoblacklight 0.3.4 → 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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +0 -5
  3. data/.travis.yml +3 -0
  4. data/README.md +24 -76
  5. data/Rakefile +2 -3
  6. data/app/assets/javascripts/geoblacklight/downloaders.js +1 -0
  7. data/app/assets/javascripts/geoblacklight/downloaders/downloader.js +51 -0
  8. data/app/assets/javascripts/geoblacklight/downloaders/hgl_downloader.js +32 -0
  9. data/app/assets/javascripts/geoblacklight/modules/download.js +7 -41
  10. data/app/controllers/download_controller.rb +19 -1
  11. data/app/controllers/wms_controller.rb +1 -1
  12. data/app/views/catalog/_show_sidebar.html.erb +25 -13
  13. data/app/views/download/hgl.html.erb +25 -0
  14. data/config/locales/geoblacklight.en.yml +1 -0
  15. data/lib/generators/geoblacklight/install_generator.rb +3 -2
  16. data/lib/generators/geoblacklight/templates/geoblacklight.js +1 -0
  17. data/lib/geoblacklight.rb +2 -0
  18. data/lib/geoblacklight/constants.rb +2 -1
  19. data/lib/geoblacklight/download/hgl_download.rb +17 -0
  20. data/lib/geoblacklight/engine.rb +1 -0
  21. data/lib/geoblacklight/solr_document.rb +4 -0
  22. data/lib/geoblacklight/version.rb +1 -1
  23. data/lib/geoblacklight/wms_layer.rb +31 -31
  24. data/lib/geoblacklight/wms_layer/feature_info_response.rb +26 -24
  25. data/lib/tasks/geoblacklight.rake +2 -2
  26. data/spec/controllers/download_controller_spec.rb +13 -2
  27. data/spec/features/download_layer_spec.rb +18 -3
  28. data/spec/features/home_page_spec.rb +3 -3
  29. data/spec/features/layer_preview_spec.rb +3 -3
  30. data/spec/features/split_view.html.erb_spec.rb +2 -4
  31. data/spec/fixtures/solr_documents/actual-papermap1.json +26 -0
  32. data/spec/fixtures/solr_documents/actual-point1.json +27 -0
  33. data/spec/fixtures/solr_documents/actual-polygon1.json +26 -0
  34. data/spec/fixtures/solr_documents/actual-raster1.json +44 -0
  35. data/spec/fixtures/{test-dct-references6.json → solr_documents/harvard_raster.json} +2 -6
  36. data/spec/fixtures/solr_documents/public_iiif_princeton.json +38 -0
  37. data/spec/fixtures/solr_documents/public_polygon_mit.json +47 -0
  38. data/spec/fixtures/solr_documents/restricted-line.json +43 -0
  39. data/spec/lib/geoblacklight/download/hgl_download_spec.rb +14 -0
  40. data/spec/lib/geoblacklight/solr_document_spec.rb +20 -0
  41. data/spec/lib/geoblacklight/wms_layer/feature_info_response_spec.rb +5 -5
  42. data/spec/lib/geoblacklight/wms_layer_spec.rb +4 -4
  43. metadata +25 -22
  44. data/spec/features/dct_references_spec.rb +0 -77
  45. data/spec/fixtures/test-dct-references1.json +0 -38
  46. data/spec/fixtures/test-dct-references2.json +0 -41
  47. data/spec/fixtures/test-dct-references3.json +0 -45
  48. data/spec/fixtures/test-dct-references4.json +0 -60
  49. data/spec/fixtures/test-dct-references5.json +0 -57
  50. data/spec/fixtures/test-dct-references7.json +0 -42
  51. data/spec/fixtures/test-dct-references8.json +0 -46
  52. data/spec/support/dct_references_generate.rb +0 -100
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd5d9169412d20001902df8f9b190829237ae511
4
- data.tar.gz: d2eaeafd8633c2512d0f917f5a45e25981036167
3
+ metadata.gz: 969739fdc56829f296f49fdc519cfcd57cdafd7c
4
+ data.tar.gz: 5e1c94e9c07557e959e787727130109289c5261f
5
5
  SHA512:
6
- metadata.gz: 26a1988031a4e0ec4bf578911c62708a23c25da3a5da487c3b22ff38ff0ca4697ec08e33f0fe49cc35bfb75c06fa3c17d0f6d72697d2ada5fa5bd394b5cc4f1a
7
- data.tar.gz: beeeb39b51cef29487020632e867f3c50389f3cd4bd99ae960420f5e3b98c1ae63f1c287448151952b8fac916a804427e2a08a044c06fce31e00d67d5fb29d7a
6
+ metadata.gz: bdbc61dc63defcf0b47ede1f235db3498ebaaa6c0c71e31acde2a3f089cf69ef4975f3ec59aad0d19fc3c16d983d04b01c9025dc112430821cf80665d82d48d4
7
+ data.tar.gz: b707a45223963f466216cc1b8e4180ebcc1a5175e55c9dc70d30bc028dac7a16e5a2e451c4eb8afb128f807b60a32bb6af87285c4cec7b867d02b71ff8020c8c
data/.gitmodules CHANGED
@@ -1,5 +0,0 @@
1
- [submodule "geoblacklight-schema"]
2
- path = schema
3
- url = https://github.com/geoblacklight/geoblacklight-schema.git
4
- branch = master
5
-
data/.travis.yml CHANGED
@@ -1,3 +1,6 @@
1
+ cache: bundler
2
+ language: ruby
3
+ sudo: false
1
4
  notifications:
2
5
  email: false
3
6
 
data/README.md CHANGED
@@ -6,88 +6,29 @@ GeoBlacklight is a world-class discovery platform for geospatial (GIS) holdings.
6
6
  is an open collaborative project aiming to build off of the successes
7
7
  of the Blacklight Solr-powered discovery interface and the
8
8
  multi-institutional OpenGeoportal federated metadata sharing
9
- communities. We are currently in a collaborative design phase and
10
- we're actively looking for community input and development partners.
11
- More coming soon!
9
+ communities. We're actively looking for community input and development partners.
12
10
 
13
- ## Features
11
+ ###[Installation](https://github.com/geoblacklight/geoblacklight/wiki/Installation)
14
12
 
15
- * Text and spatial search with scoring formula
16
- * Facet by institution, year, publisher, data type, access, format
17
- * Facet by place, subject
18
- * Sort by relevance, year, publisher, title
19
- * Results list view icons and snippets
20
- * Detail map view for WMS features
21
- * Detail map view feature inspection
22
- * Slugs
23
- * Results list map view of bounding boxes
24
- * WMS/WFS/WCS links
25
- * Download Shapefile
26
- * Download KML
27
- * Download Metadata (for Stanford)
28
- * Built-in sample Solr 4.10 index
29
- * Search history
13
+ Creating a new GeoBlacklight application from the template
30
14
 
31
- ## TODO
15
+ ```
16
+ $ rails new app-name -m https://raw.githubusercontent.com/geoblacklight/geoblacklight/master/template.rb
17
+ ```
32
18
 
33
- * See https://github.com/geoblacklight/geoblacklight/issues
34
- * See https://github.com/geoblacklight/geoblacklight-schema/issues
19
+ To install Solr (with Jetty)
35
20
 
36
- ## Development
21
+ ```
22
+ $ cd app-name
23
+ $ rake jetty:download
24
+ $ rake jetty:unzip
25
+ $ rake geoblacklight:configure_jetty
26
+ ```
37
27
 
38
- To install a development instance of GeoBlacklight follow these instructions.
28
+ Or install with [Docker](https://github.com/geoblacklight/geoblacklight-docker)
29
+ For more information see the [installation guide](https://github.com/geoblacklight/geoblacklight/wiki/Installation)
39
30
 
40
- Clone the repository (using `--recurse`)
41
-
42
- git clone --recurse git@github.com:geoblacklight/geoblacklight.git
43
-
44
- Download and configure `jetty` to run Solr
45
-
46
- rake jetty:download jetty:unzip
47
- rake geoblacklight:configure_jetty
48
-
49
- Create a test app (created at `/spec/internal`)
50
-
51
- rake engine_cart:generate
52
-
53
- Boot `jetty`
54
-
55
- rake jetty:start
56
-
57
- Boot GeoBlacklight test app
58
-
59
- cd spec/internal
60
- rake geoblacklight:solr:seed # to load sample documents into jetty Solr instance
61
- rails server
62
-
63
- Run tests
64
-
65
- rake ci
66
-
67
- ## Installation
68
-
69
- To bootstrap a new GeoBlacklight Rails application
70
-
71
- $ rails new app-name -m https://raw.githubusercontent.com/geoblacklight/geoblacklight/master/template.rb
72
-
73
- To install Solr (with jetty)
74
-
75
- $ cd app-name
76
- $ rake jetty:download
77
- $ rake jetty:unzip
78
- $ rake geoblacklight:configure_jetty
79
-
80
-
81
- ## Usage
82
-
83
- For a non-development instance:
84
-
85
- 1. Populate a Solr 4.7 index with geoblacklight-schema documents
86
- 2. Configure your GeoBlacklight application's `config/solr.yml` to point to the Solr index
87
- 3. Configure your `config/environments` and `app/controllers/catalog_controller.rb`
88
- 4. `rails server` to run GeoBlacklight
89
-
90
- ## Contributing
31
+ ###[Contributing](https://github.com/geoblacklight/geoblacklight/wiki/Contributing)
91
32
 
92
33
  1. Fork it ( http://github.com/my-github-username/geoblacklight/fork )
93
34
  2. Create your feature branch (`git checkout -b my-new-feature`)
@@ -95,4 +36,11 @@ For a non-development instance:
95
36
  4. Push to the branch (`git push origin my-new-feature`)
96
37
  5. Create new Pull Request
97
38
 
98
- Also, if you wish to ask questions or participate further, email the [GeoBlacklight Working Group](https://groups.google.com/forum/#!forum/geoblacklight-working-group) at geoblacklight-working-group@googlegroups.com.
39
+ Also, if you wish to ask questions or participate further, email the [GeoBlacklight Working Group](https://groups.google.com/forum/#!forum/geoblacklight-working-group) at [geoblacklight-working-group@googlegroups.com](mailto:geoblacklight-working-group@googlegroups.com).
40
+
41
+ ###[Development](https://github.com/geoblacklight/geoblacklight/wiki/Development)
42
+
43
+ See the [development guide](https://github.com/geoblacklight/geoblacklight/wiki/Development) on our wiki for more information about setting up your development environment.
44
+
45
+
46
+ Please see the full documentation hosted on our Wiki [Wiki](https://github.com/geoblacklight/geoblacklight/wiki)
data/Rakefile CHANGED
@@ -43,8 +43,7 @@ end
43
43
  namespace :geoblacklight do
44
44
  desc "Copies the default SOLR config for the bundled Testing Server"
45
45
  task :configure_jetty do
46
- FileList['schema/conf/*'].each do |f|
47
- cp("#{f}", 'jetty/solr/blacklight-core/conf/', :verbose => true)
48
- end
46
+ system 'curl -o jetty/solr/blacklight-core/conf/schema.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/schema.xml'
47
+ system 'curl -o jetty/solr/blacklight-core/conf/solrconfig.xml https://raw.githubusercontent.com/geoblacklight/geoblacklight-schema/master/conf/solrconfig.xml'
49
48
  end
50
49
  end
@@ -0,0 +1 @@
1
+ //= require_tree ./downloaders
@@ -0,0 +1,51 @@
1
+ !(function(global) {
2
+ 'use strict';
3
+
4
+ var Downloader = L.Class.extend({
5
+ options: {
6
+ spinner: $('<i class="fa fa-spinner fa-spin fa-2x fa-align-center"></i>')
7
+ },
8
+
9
+ initialize: function(el, options) {
10
+ L.Util.setOptions(this, options);
11
+ this.$el = $(el);
12
+ this.configureHandler();
13
+ },
14
+
15
+ configureHandler: function() {
16
+ this.$el.on('click', L.Util.bind(this.download, this));
17
+ },
18
+
19
+ download: function(ev) {
20
+ var url = this.$el.data('downloadPath');
21
+ ev.preventDefault();
22
+ this.$el.closest('.btn-group').append(this.options.spinner);
23
+ $.getJSON(url)
24
+ .done(L.Util.bind(this.complete, this))
25
+ .fail(L.Util.bind(this.error, this));
26
+ },
27
+
28
+ complete: function(data) {
29
+ this.renderMessage(data);
30
+ this.options.spinner.hide();
31
+ },
32
+
33
+ error: function(data) {
34
+ this.options.spinner.hide();
35
+ },
36
+
37
+ renderMessage: function(message) {
38
+ $.each(message, function(idx, msg) {
39
+ var flash = '<div class="alert alert-' + msg[0] + '"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + msg[1] + '</div>';
40
+ $('div.flash_messages').append(flash);
41
+ });
42
+ }
43
+
44
+ });
45
+
46
+ global.GeoBlacklight.Downloader = Downloader;
47
+ global.GeoBlacklight.downloader = function(el, options) {
48
+ return new Downloader(el, options);
49
+ };
50
+
51
+ })(this);
@@ -0,0 +1,32 @@
1
+ //= require geoblacklight/downloaders/downloader
2
+
3
+ !(function(global) {
4
+ 'use strict';
5
+
6
+ var HglDownloader = global.GeoBlacklight.Downloader.extend({
7
+
8
+ configureHandler: function() {
9
+ this.$el.on('submit', L.Util.bind(this.download, this));
10
+ },
11
+
12
+ download: function(ev) {
13
+ var url, email;
14
+ ev.preventDefault();
15
+ $(this.options.modal).modal('hide');
16
+ email = this.$el.find('#requestEmail').val();
17
+ url = this.$el.find('#requestUrl').val();
18
+
19
+ $.get(url, { email: email })
20
+ .done(L.Util.bind(this.complete, this))
21
+ .fail(L.Util.bind(this.error, this));
22
+ }
23
+
24
+ });
25
+
26
+ global.GeoBlacklight.HglDownloader = HglDownloader;
27
+ global.GeoBlacklight.hglDownloader = function(el, options) {
28
+ return new HglDownloader(el, options);
29
+ };
30
+
31
+
32
+ })(this);
@@ -1,45 +1,11 @@
1
1
  Blacklight.onLoad(function() {
2
- var downloads = [];
3
2
  $('[data-download-path]').each(function(i, element) {
4
- downloads.push(new GeoBlacklight.Download(element));
3
+ GeoBlacklight.downloader(element);
5
4
  });
6
- });
7
-
8
- GeoBlacklight.Download = function(element) {
9
- var _this = this;
10
- _this.element = $(element);
11
- _this.url = _this.element.data('download-path');
12
- _this.buttonGroup = _this.element.closest('.btn-group');
13
- _this.spinner = $('<i class="fa fa-spinner fa-spin fa-2x fa-align-center"></i>');
14
- _this.buttonGroup.append(_this.spinner.hide());
15
- _this.setupClickListener();
16
- };
17
-
18
- GeoBlacklight.Download.prototype = {
19
- setupClickListener: function() {
20
- var _this = this;
21
- _this.element.on('click', function(e) {
22
- e.preventDefault();
23
- _this.requestDownload();
24
- });
25
- },
26
- requestDownload: function() {
27
- var _this = this;
28
- _this.spinner.show();
29
- $.ajax({
30
- url: _this.url,
31
- dataType: 'json'
32
- }).done(function(data) {
33
- _this.renderFlashMessage(data);
34
- _this.spinner.hide();
35
- }).fail(function(data, e) {
36
- _this.spinner.hide();
37
- });
38
- },
39
- renderFlashMessage: function(response) {
40
- $.each(response, function(i, val) {
41
- var flashHtml = '<div class="alert alert-' + val[0] + '"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>' + val[1] + '</div>';
42
- $('div.flash_messages').append(flashHtml);
5
+ $('#ajax-modal').on('loaded.blacklight.ajax-modal', function() {
6
+ var modal = this;
7
+ $(this).find('#hglRequest').each(function() {
8
+ GeoBlacklight.hglDownloader(this, { modal: modal });
43
9
  });
44
- }
45
- };
10
+ });
11
+ });
@@ -19,6 +19,24 @@ class DownloadController < ApplicationController
19
19
  send_file "tmp/cache/downloads/#{params[:id]}.#{params[:format]}", type: 'application/zip', x_sendfile: true
20
20
  end
21
21
 
22
+ def hgl
23
+ @response, @document = get_solr_response_for_doc_id
24
+ if params[:email]
25
+ response = HglDownload.new(@document, params[:email]).get
26
+ if response.nil?
27
+ flash[:danger] = t 'geoblacklight.download.error'
28
+ else
29
+ flash[:success] = t 'geoblacklight.download.hgl_success'
30
+ end
31
+ respond_to do |format|
32
+ format.json { render json: flash, response: response }
33
+ format.html { render json: flash, response: response }
34
+ end
35
+ else
36
+ render layout: false
37
+ end
38
+ end
39
+
22
40
  private
23
41
 
24
42
  def check_type
@@ -49,7 +67,7 @@ class DownloadController < ApplicationController
49
67
  authenticate_user!
50
68
  end
51
69
  end
52
-
70
+
53
71
  def file_name_to_id(file_name)
54
72
  file_name.split('-')[0..-2].join('-')
55
73
  end
@@ -1,6 +1,6 @@
1
1
  class WmsController < ApplicationController
2
2
  def handle
3
- response = WmsLayer.new(params).get_feature_info
3
+ response = Geoblacklight::WmsLayer.new(params).get_feature_info
4
4
 
5
5
  respond_to do |format|
6
6
  format.json { render json: response }
@@ -2,7 +2,7 @@
2
2
 
3
3
  <div id='geoblacklight-tools'>
4
4
  <div class="panel panel-default show-tools">
5
- <div class="panel-heading">
5
+ <div class="panel-heading">
6
6
  Tools
7
7
  </div>
8
8
  <div class="panel-body">
@@ -13,12 +13,16 @@
13
13
  <%- end -%>
14
14
  <%- if @document.respond_to?( :to_sms_text ) -%>
15
15
  <%= link_to sms_helper, sms_catalog_path(:id => @document), {:id => 'smsLink', :data => {:ajax_modal => "trigger"}, :class => 'list-group-item'} %>
16
- <%- end -%>
16
+ <%- end -%>
17
17
  </ul>
18
18
  <% if document_downloadable? %>
19
19
  <div class='btn-group' itemprop='distribution' itemscope='itemscope' itemtype='http://schema.org/DataDownload'>
20
- <% unless document.direct_download.blank? %>
20
+ <% if document.direct_download.present? %>
21
21
  <%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], class: 'btn btn-default', 'contentUrl' => document.direct_download[:download]) %>
22
+ <% elsif document.hgl_download.present? %>
23
+ <%= link_to(download_text(document.download_types.first[0]),
24
+ download_hgl_path(id: document), data: {ajax_modal: 'trigger'},
25
+ class: 'btn btn-default') %>
22
26
  <% else %>
23
27
  <%= 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') %>
24
28
  <% end %>
@@ -27,20 +31,28 @@
27
31
  <span class='sr-only'>Toggle Download Dropdown</span>
28
32
  </button>
29
33
  <ul class='dropdown-menu' role='menu'>
30
- <% unless document.direct_download.blank? %>
34
+ <% if document.hgl_download.present? %>
31
35
  <li role="presentation" class="dropdown-header">Original</li>
32
36
  <li>
33
- <%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
37
+ <%= link_to(download_text(document.download_types.first[0]),
38
+ download_hgl_path(id: document), data: {ajax_modal: 'trigger'}) %>
34
39
  </li>
35
- <% end %>
36
- <% if document.download_types.present? %>
37
- <li role="presentation" class="dropdown-header">Generated</li>
38
- <% document.download_types.each do |type| %>
39
- <%= content_tag(:li) do %>
40
- <% link_to(download_text(type[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
40
+ <% else %>
41
+ <% if document.direct_download.present? %>
42
+ <li role="presentation" class="dropdown-header">Original</li>
43
+ <li>
44
+ <%= link_to(download_text(@document[:dc_format_s]), document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
45
+ </li>
46
+ <% end %>
47
+ <% if document.download_types.present? %>
48
+ <li role="presentation" class="dropdown-header">Generated</li>
49
+ <% document.download_types.each do |type| %>
50
+ <%= content_tag(:li) do %>
51
+ <% link_to(download_text(type[0]), '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
52
+ <% end %>
41
53
  <% end %>
42
- <% end %>
43
- <% end %>
54
+ <% end %>
55
+ <% end %>
44
56
  </ul>
45
57
  </div>
46
58
  <% elsif document.restricted? && document.same_institution? %>
@@ -0,0 +1,25 @@
1
+ <div class="modal-header">
2
+ <button type="button" class="close" data-dismiss="modal">
3
+ <span aria-hidden="true">&times;</span>
4
+ </button>
5
+ <h4 class="modal-title">Request Layer</h4>
6
+ </div>
7
+ <div class="modal-body">
8
+ <form class="form-horizontal" role="form" id="hglRequest">
9
+ <p>Please enter your email address. You will receive a link to download the layer when it is ready.</p>
10
+ <div class="form-group">
11
+ <label for="requestEmail" class="col-sm-2 control-label">Email</label>
12
+ <div class="col-sm-6">
13
+ <input class="form-control" type="email" id="requestEmail" />
14
+ </div>
15
+ <input type="hidden" id="requestUrl"
16
+ value="<%= download_hgl_path(id: @document) %>" />
17
+ <div class="col-sm-2">
18
+ <button type="submit" class="btn btn-primary">Request</button>
19
+ </div>
20
+ </div>
21
+ </form>
22
+ </div>
23
+ <div class="modal-footer">
24
+ <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
25
+ </div>
@@ -3,6 +3,7 @@ en:
3
3
  download:
4
4
  download: 'Download'
5
5
  success: 'Your file %{title} is ready for download'
6
+ hgl_success: 'You should receive an email when your download is ready'
6
7
  error: 'Sorry, the requested file could not be downloaded'
7
8
  home:
8
9
  headline: 'Explore and discover...'