Skip to content

Commit

Permalink
JS: fix customized viewer initialization error (#624)
Browse files Browse the repository at this point in the history
* JS: fix customized viewer initialization error by adding all GBL viewers locally

Fixes #623

* Gems: bump GBLSCI to latest
  • Loading branch information
ewlarson authored Nov 4, 2024
1 parent 62ae688 commit 5fcfb47
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ gem 'noticed'
gem 'paper_trail'

# Image migration
gem 'geoblacklight_sidecar_images', git: "https://github.com/geoblacklight/geoblacklight_sidecar_images.git", branch: "feature/statesman-update"
gem 'geoblacklight_sidecar_images', git: "https://github.com/geoblacklight/geoblacklight_sidecar_images.git", branch: "develop"
gem 'mini_magick', '~> 4.9.4'
gem "image_processing", ">= 1.2"

Expand Down
10 changes: 5 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ GIT

GIT
remote: https://github.com/geoblacklight/geoblacklight_sidecar_images.git
revision: 089e2a4a677a5d522b9d88fef0ef46cfa69961a0
branch: feature/statesman-update
revision: ca23e5ef8eb4fa90d5c9cb955943deeb0dcba6f5
branch: develop
specs:
geoblacklight_sidecar_images (1.0.0)
geoblacklight_sidecar_images (1.1.0)
faraday (>= 2.0)
geoblacklight (~> 4.0)
image_processing (~> 1.6)
mimemagic (~> 0.3)
mini_magick (~> 4.9.4)
rails (>= 5.2, < 7.1)
statesman (~> 10.0.0)
rails (>= 5.2, < 8.0)
statesman (>= 3.4)

GIT
remote: https://github.com/geobtaa/geoblacklight_admin.git
Expand Down
5 changes: 3 additions & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
//= require geoblacklight/viewers/viewer
//= require ./geoportal/viewers/map
//= require ./geoportal/viewers/b1g_image
//= require ./geoportal/viewers/cog
//= require ./geoportal/viewers/download
//= require ./geoportal/viewers/esri
//= require ./geoportal/viewers/esri/dynamic_map_layer
Expand All @@ -50,10 +51,10 @@
//= require ./geoportal/viewers/iiif_manifest
//= require ./geoportal/viewers/index_map
//= require geoblacklight/viewers/oembed

//= require ./geoportal/viewers/wms
//= require ./geoportal/viewers/pmtiles
//= require ./geoportal/viewers/tilejson
//= require ./geoportal/viewers/tms
//= require ./geoportal/viewers/wms
//= require ./geoportal/viewers/wmts
//= require ./geoportal/viewers/xyz

Expand Down
5 changes: 5 additions & 0 deletions app/assets/javascripts/geoportal/viewers/cog.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//= require geoblacklight/viewers/viewer

GeoBlacklight.Viewer.Cog = GeoBlacklight.Viewer.extend({
load: function() {}
});
25 changes: 25 additions & 0 deletions app/assets/javascripts/geoportal/viewers/iiif.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//= require geoblacklight/viewers/viewer

GeoBlacklight.Viewer.Iiif = GeoBlacklight.Viewer.extend({
load: function() {
this.adjustLayout();

this.map = L.map(this.element, {
center: [0, 0],
crs: L.CRS.Simple,
zoom: 0
});
this.loadControls();
this.iiifLayer = L.tileLayer.iiif(this.data.url)
.addTo(this.map);
},

adjustLayout: function() {

// hide attribute table
$('#table-container').hide();

// expand viewer element
$(this.element).parent().attr('class', 'col-md-12');
}
});
13 changes: 13 additions & 0 deletions app/assets/javascripts/geoportal/viewers/oembed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//= require geoblacklight/viewers/viewer

GeoBlacklight.Viewer.Oembed = GeoBlacklight.Viewer.extend({
load: function() {
var $el = $(this.element);
$.getJSON(this.data.url, function(data){
if (data === null){
return;
}
$el.html(data.html);
});
},
});
5 changes: 5 additions & 0 deletions app/assets/javascripts/geoportal/viewers/pmtiles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//= require geoblacklight/viewers/viewer

GeoBlacklight.Viewer.Pmtiles = GeoBlacklight.Viewer.extend({
load: function() {}
});

0 comments on commit 5fcfb47

Please sign in to comment.