Skip to content

Commit

Permalink
JS: fix customized viewer initialization error by adding all GBL view…
Browse files Browse the repository at this point in the history
…ers locally

Fixes #623
  • Loading branch information
ewlarson committed Nov 4, 2024
1 parent 62ae688 commit c484227
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 2 deletions.
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 c484227

Please sign in to comment.