geoblacklight_sidecar_images 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.rubocop.yml +80 -0
- data/.travis.yml +29 -0
- data/Gemfile +47 -0
- data/LICENSE +201 -0
- data/README.md +45 -0
- data/Rakefile +37 -0
- data/app/assets/config/geoblacklight_sidecar_images_manifest.js +2 -0
- data/app/assets/images/geoblacklight_sidecar_images/.keep +0 -0
- data/app/assets/javascripts/geoblacklight_sidecar_images/application.js +13 -0
- data/app/assets/stylesheets/geoblacklight_sidecar_images/application.css +15 -0
- data/app/controllers/geoblacklight_sidecar_images/application_controller.rb +5 -0
- data/app/helpers/geoblacklight_sidecar_images/application_helper.rb +4 -0
- data/app/jobs/geoblacklight_sidecar_images/application_job.rb +4 -0
- data/app/mailers/geoblacklight_sidecar_images/application_mailer.rb +6 -0
- data/app/models/geoblacklight_sidecar_images/application_record.rb +5 -0
- data/app/views/layouts/geoblacklight_sidecar_images/application.html.erb +14 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20180118203155_create_solr_document_sidecars.rb +12 -0
- data/geoblacklight_sidecar_images.gemspec +37 -0
- data/lib/generators/geoblacklight_sidecar_images/assets_generator.rb +31 -0
- data/lib/generators/geoblacklight_sidecar_images/example_docs_generator.rb +18 -0
- data/lib/generators/geoblacklight_sidecar_images/install_generator.rb +58 -0
- data/lib/generators/geoblacklight_sidecar_images/jobs_generator.rb +27 -0
- data/lib/generators/geoblacklight_sidecar_images/models_generator.rb +60 -0
- data/lib/generators/geoblacklight_sidecar_images/services_generator.rb +19 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-image.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-line.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-mixed.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-multipoint.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-paper-map.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-point.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-polygon.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-raster.png +0 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/javascripts/geoblacklight.js +9 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/assets/stylesheets/geoblacklight.scss +3 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/jobs/store_image_job.rb +8 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/models/concerns/wms_rewrite_concern.rb +20 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/models/solr_document_sidecar.rb +16 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service.rb +193 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/dynamic_map_layer.rb +11 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/iiif.rb +13 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/image_map_layer.rb +13 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/tiled_map_layer.rb +11 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/services/image_service/wms.rb +24 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/uploaders/image_uploader.rb +53 -0
- data/lib/generators/geoblacklight_sidecar_images/templates/views/catalog/_index_split_default.html.erb +27 -0
- data/lib/generators/geoblacklight_sidecar_images/uploaders_generator.rb +19 -0
- data/lib/generators/geoblacklight_sidecar_images/views_generator.rb +21 -0
- data/lib/geoblacklight_sidecar_images.rb +5 -0
- data/lib/geoblacklight_sidecar_images/engine.rb +5 -0
- data/lib/geoblacklight_sidecar_images/version.rb +3 -0
- data/lib/tasks/geoblacklight_sidecar_images_tasks.rake +76 -0
- data/solr/conf/_rest_managed.json +3 -0
- data/solr/conf/admin-extra.html +31 -0
- data/solr/conf/elevate.xml +36 -0
- data/solr/conf/mapping-ISOLatin1Accent.txt +246 -0
- data/solr/conf/protwords.txt +21 -0
- data/solr/conf/schema.xml +190 -0
- data/solr/conf/scripts.conf +24 -0
- data/solr/conf/solrconfig.xml +243 -0
- data/solr/conf/spellings.txt +2 -0
- data/solr/conf/stopwords.txt +58 -0
- data/solr/conf/stopwords_en.txt +58 -0
- data/solr/conf/synonyms.txt +31 -0
- data/solr/conf/xslt/example.xsl +132 -0
- data/solr/conf/xslt/example_atom.xsl +67 -0
- data/solr/conf/xslt/example_rss.xsl +66 -0
- data/solr/conf/xslt/luke.xsl +337 -0
- data/spec/fixtures/files/actual-papermap1.json +23 -0
- data/spec/fixtures/files/actual-point1.json +24 -0
- data/spec/fixtures/files/actual-polygon1.json +23 -0
- data/spec/fixtures/files/actual-raster1.json +37 -0
- data/spec/fixtures/files/baruch_ancestor1.json +46 -0
- data/spec/fixtures/files/baruch_ancestor2.json +46 -0
- data/spec/fixtures/files/baruch_documentation_download.json +49 -0
- data/spec/fixtures/files/esri-dynamic-layer-all-layers.json +36 -0
- data/spec/fixtures/files/esri-dynamic-layer-single-layer.json +37 -0
- data/spec/fixtures/files/esri-feature-layer.json +33 -0
- data/spec/fixtures/files/esri-image-map-layer.json +21 -0
- data/spec/fixtures/files/esri-tiled_map_layer.json +22 -0
- data/spec/fixtures/files/esri-wms-layer.json +33 -0
- data/spec/fixtures/files/harvard_raster.json +44 -0
- data/spec/fixtures/files/no_spatial.json +21 -0
- data/spec/fixtures/files/public_direct_download.json +28 -0
- data/spec/fixtures/files/public_iiif_princeton.json +36 -0
- data/spec/fixtures/files/public_polygon_mit.json +39 -0
- data/spec/fixtures/files/restricted-line.json +36 -0
- data/spec/fixtures/files/umich_iiif_jpg.json +28 -0
- data/spec/fixtures/files/umn_iiif_jpg.json +30 -0
- data/spec/fixtures/files/umn_metro_result1.json +37 -0
- data/spec/fixtures/files/umn_metro_result2.json +35 -0
- data/spec/fixtures/files/umn_state_result1.json +31 -0
- data/spec/fixtures/files/umn_state_result2.json +36 -0
- data/spec/models/solr_document_sidecar_spec.rb +13 -0
- data/spec/models/solr_document_spec.rb +14 -0
- data/spec/rails_helper.rb +59 -0
- data/spec/services/image_service_spec.rb +31 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +33 -0
- data/template.rb +13 -0
- metadata +395 -0
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Geoblacklight sidecar images</title>
|
5
|
+
<%= stylesheet_link_tag "geoblacklight_sidecar_images/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "geoblacklight_sidecar_images/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateSolrDocumentSidecars < ActiveRecord::Migration[5.1]
|
2
|
+
def change
|
3
|
+
create_table :solr_document_sidecars do |t|
|
4
|
+
t.string "document_id"
|
5
|
+
t.string "document_type"
|
6
|
+
t.string "image"
|
7
|
+
t.index ["document_type", "document_id"], name: "solr_document_sidecars_solr_document"
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'geoblacklight_sidecar_images/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'geoblacklight_sidecar_images'
|
9
|
+
s.version = GeoblacklightSidecarImages::VERSION
|
10
|
+
s.authors = ['Eric Larson', 'Eliot Jordan']
|
11
|
+
s.email = ['ewlarson@umn.edu']
|
12
|
+
s.homepage = 'https://github.com/ewlarson/geoblacklight_sidecar_images'
|
13
|
+
s.summary = 'Store local copies of remote imagery in GeoBlacklight'
|
14
|
+
s.license = 'Apache 2.0'
|
15
|
+
|
16
|
+
s.files = `git ls-files -z`.split(%Q{\x0})
|
17
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_dependency 'aasm'
|
22
|
+
s.add_dependency 'carrierwave'
|
23
|
+
s.add_dependency 'geoblacklight', '~> 1.7'
|
24
|
+
s.add_dependency 'mini_magick'
|
25
|
+
s.add_dependency 'rails', '>= 4.2', '< 6'
|
26
|
+
|
27
|
+
s.add_development_dependency 'byebug'
|
28
|
+
s.add_development_dependency 'capybara'
|
29
|
+
s.add_development_dependency 'chromedriver-helper'
|
30
|
+
s.add_development_dependency 'database_cleaner', '~> 1.3'
|
31
|
+
s.add_development_dependency 'engine_cart', '~> 1.0'
|
32
|
+
s.add_development_dependency 'rspec-rails', '~> 3.0'
|
33
|
+
s.add_development_dependency 'rubocop', '~> 0.53.0'
|
34
|
+
s.add_development_dependency 'rubocop-rspec', '~> 1.18.0'
|
35
|
+
s.add_development_dependency 'selenium-webdriver'
|
36
|
+
s.add_development_dependency 'solr_wrapper'
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module GeoblacklightSidecarImages
|
6
|
+
class AssetsGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
8
|
+
|
9
|
+
desc <<-DESCRIPTION
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
1. Copies asset image files to host app/assets/images
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
def create_images_assets
|
15
|
+
thumbs = [
|
16
|
+
'thumbnail-image.png',
|
17
|
+
'thumbnail-line.png',
|
18
|
+
'thumbnail-mixed.png',
|
19
|
+
'thumbnail-multipoint.png',
|
20
|
+
'thumbnail-paper-map.png',
|
21
|
+
'thumbnail-point.png',
|
22
|
+
'thumbnail-polygon.png',
|
23
|
+
'thumbnail-raster.png'
|
24
|
+
]
|
25
|
+
|
26
|
+
thumbs.each do |tbnl|
|
27
|
+
copy_file("assets/images/#{tbnl}", "app/assets/images/#{tbnl}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module GeoblacklightSidecarImages
|
6
|
+
class ExampleDocsGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('../../../spec/fixtures', __dir__)
|
8
|
+
|
9
|
+
desc <<-DESCRIPTION
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
1. Copies the dir of example solr doc files to host app/solr/geoblacklight/example_docs
|
12
|
+
DESCRIPTION
|
13
|
+
|
14
|
+
def create_services
|
15
|
+
directory 'files', 'solr/geoblacklight/example_docs'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module GeoblacklightSidecarImages
|
4
|
+
class Install < Rails::Generators::Base
|
5
|
+
source_root File.expand_path('templates', __dir__)
|
6
|
+
|
7
|
+
desc 'Install GeoblacklightSidecarImages'
|
8
|
+
|
9
|
+
def add_settings_vars
|
10
|
+
inject_into_file 'config/settings.yml', after: "INSTITUTION: 'Stanford'\n" do
|
11
|
+
"INSTITUTION_LOCAL_NAME: 'Princeton'
|
12
|
+
INSTITUTION_GEOSERVER_URL: 'https://geoserver.princeton.edu'
|
13
|
+
PROXY_GEOSERVER_URL: 'http://localhost:3000'
|
14
|
+
PROXY_GEOSERVER_AUTH: 'Basic base64encodedusername:password'"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_carrierwave_require
|
19
|
+
inject_into_file 'config/application.rb', after: "require 'rails/all'" do
|
20
|
+
"\n require 'carrierwave'"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def generate_geoblacklight_assets
|
25
|
+
generate 'geoblacklight_sidecar_images:assets'
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_geoblacklight_example_docs
|
29
|
+
generate 'geoblacklight_sidecar_images:example_docs'
|
30
|
+
end
|
31
|
+
|
32
|
+
def generate_geoblacklight_jobs
|
33
|
+
generate 'geoblacklight_sidecar_images:jobs'
|
34
|
+
end
|
35
|
+
|
36
|
+
def generate_geoblacklight_models
|
37
|
+
generate 'geoblacklight_sidecar_images:models'
|
38
|
+
end
|
39
|
+
|
40
|
+
def generate_geoblacklight_services
|
41
|
+
generate 'geoblacklight_sidecar_images:services'
|
42
|
+
end
|
43
|
+
|
44
|
+
def generate_geoblacklight_uploaders
|
45
|
+
generate 'geoblacklight_sidecar_images:uploaders'
|
46
|
+
end
|
47
|
+
|
48
|
+
def generate_geoblacklight_views
|
49
|
+
generate 'geoblacklight_sidecar_images:views'
|
50
|
+
end
|
51
|
+
|
52
|
+
def bundle_install
|
53
|
+
Bundler.with_clean_env do
|
54
|
+
run 'bundle install'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module GeoblacklightSidecarImages
|
6
|
+
class JobsGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
8
|
+
|
9
|
+
desc <<-DESCRIPTION
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
1. Copies jobs files to host app/jobs
|
12
|
+
2. Configures a default development environment queue adapter
|
13
|
+
DESCRIPTION
|
14
|
+
|
15
|
+
def create_store_image_jobs
|
16
|
+
copy_file 'jobs/store_image_job.rb', 'app/jobs/store_image_job.rb'
|
17
|
+
end
|
18
|
+
|
19
|
+
def config_development_jobs_queue_adapter
|
20
|
+
job_config = <<-"JOBS"
|
21
|
+
config.active_job.queue_adapter = :inline
|
22
|
+
JOBS
|
23
|
+
|
24
|
+
inject_into_file 'config/environments/development.rb', job_config, before: /^end/
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
require 'rails/generators/migration'
|
5
|
+
|
6
|
+
module GeoblacklightSidecarImages
|
7
|
+
class ModelsGenerator < Rails::Generators::Base
|
8
|
+
include Rails::Generators::Migration
|
9
|
+
|
10
|
+
source_root File.expand_path('templates', __dir__)
|
11
|
+
|
12
|
+
desc <<-DESCRIPTION
|
13
|
+
This generator makes the following changes to your application:
|
14
|
+
1. Preps engine migrations
|
15
|
+
2. Adds SolrDocumentSidecar ActiveRecord model
|
16
|
+
3. Adds WmsRewriteConcern
|
17
|
+
DESCRIPTION
|
18
|
+
|
19
|
+
# Setup the database migrations
|
20
|
+
def copy_migrations
|
21
|
+
rake 'geoblacklight_sidecar_images:install:migrations'
|
22
|
+
end
|
23
|
+
|
24
|
+
def include_sidecar_solrdocument
|
25
|
+
sidecar = <<-"SIDECAR"
|
26
|
+
def sidecar
|
27
|
+
SolrDocumentSidecar.find_or_create_by!(
|
28
|
+
document_id: id,
|
29
|
+
document_type: self.class.to_s
|
30
|
+
)
|
31
|
+
end
|
32
|
+
SIDECAR
|
33
|
+
|
34
|
+
inject_into_file 'app/models/solr_document.rb', sidecar, before: /^end/
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_solr_document_sidecar
|
38
|
+
copy_file(
|
39
|
+
'models/solr_document_sidecar.rb',
|
40
|
+
'app/models/solr_document_sidecar.rb'
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def create_wms_rewrite_concern
|
45
|
+
copy_file(
|
46
|
+
'models/concerns/wms_rewrite_concern.rb',
|
47
|
+
'app/models/concerns/wms_rewrite_concern.rb'
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
def include_wms_rewrite_solrdocument
|
52
|
+
inject_into_file(
|
53
|
+
'app/models/solr_document.rb',
|
54
|
+
after: 'include Geoblacklight::SolrDocument'
|
55
|
+
) do
|
56
|
+
"\n include WmsRewriteConcern"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module GeoblacklightSidecarImages
|
6
|
+
class ServicesGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path('templates', __dir__)
|
8
|
+
|
9
|
+
desc <<-DESCRIPTION
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
1. Creates an app/services directory
|
12
|
+
2. Creates service models within the app/services directory
|
13
|
+
DESCRIPTION
|
14
|
+
|
15
|
+
def create_services
|
16
|
+
directory 'services', 'app/services'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-multipoint.png
ADDED
Binary file
|
data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-paper-map.png
ADDED
Binary file
|
Binary file
|
data/lib/generators/geoblacklight_sidecar_images/templates/assets/images/thumbnail-polygon.png
ADDED
Binary file
|
Binary file
|
data/lib/generators/geoblacklight_sidecar_images/templates/assets/javascripts/geoblacklight.js
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
//= require geoblacklight/geoblacklight
|
2
|
+
//= require geoblacklight/basemaps
|
3
|
+
//= require geoblacklight/controls
|
4
|
+
//= require geoblacklight/viewers
|
5
|
+
//= require geoblacklight/modules
|
6
|
+
//= require geoblacklight/downloaders
|
7
|
+
//= require leaflet-iiif
|
8
|
+
//= require esri-leaflet
|
9
|
+
//= require readmore.min
|
data/lib/generators/geoblacklight_sidecar_images/templates/models/concerns/wms_rewrite_concern.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module WmsRewriteConcern
|
2
|
+
extend Geoblacklight::SolrDocument
|
3
|
+
|
4
|
+
def viewer_endpoint
|
5
|
+
if local_restricted?
|
6
|
+
# replace wms prefix with cas authed proxy
|
7
|
+
super.gsub(Settings.INSTITUTION_GEOSERVER_URL, Settings.PROXY_GEOSERVER_URL)
|
8
|
+
else
|
9
|
+
super
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def local_restricted?
|
14
|
+
local? && restricted?
|
15
|
+
end
|
16
|
+
|
17
|
+
def local?
|
18
|
+
fetch(:dct_provenance_s, '').casecmp(Settings.INSTITUTION_LOCAL_NAME).zero?
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
##
|
2
|
+
# Metadata for indexed documents
|
3
|
+
class SolrDocumentSidecar < ApplicationRecord
|
4
|
+
mount_uploader :image, ImageUploader
|
5
|
+
|
6
|
+
belongs_to :document, required: true, polymorphic: true
|
7
|
+
|
8
|
+
# Roll our own polymorphism because our documents are not AREL-able
|
9
|
+
def document
|
10
|
+
document_type.new document_type.unique_key => document_id
|
11
|
+
end
|
12
|
+
|
13
|
+
def document_type
|
14
|
+
(super.constantize if defined?(super)) || default_document_type
|
15
|
+
end
|
16
|
+
end
|