Skip to content

Commit

Permalink
Implement as viewer instead of as partial addition
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Aug 8, 2019
1 parent 3c46257 commit ac44356
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
11 changes: 0 additions & 11 deletions app/assets/javascripts/geoblacklight/modules/oembed.js

This file was deleted.

13 changes: 13 additions & 0 deletions app/assets/javascripts/geoblacklight/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: 0 additions & 5 deletions app/views/catalog/_show_default_oembed.html.erb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class CatalogController < ApplicationController
# solr field configuration for document/show views

config.show.display_type_field = 'format'
config.show.partials << 'show_default_oembed'
config.show.partials << 'show_default_viewer_container'
config.show.partials << 'show_default_attribute_table'
config.show.partials << 'show_default_viewer_information'
Expand Down
6 changes: 5 additions & 1 deletion lib/geoblacklight/item_viewer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ def index_map
@references.index_map
end

def oembed
@references.oembed
end

def viewer_preference
[index_map, wms, iiif, tiled_map_layer, dynamic_map_layer,
[oembed, index_map, wms, iiif, tiled_map_layer, dynamic_map_layer,
image_map_layer, feature_layer].compact.map(&:to_hash).first
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/oembed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
scenario 'Should show oembed content and map' do
visit solr_document_path('stanford-dc482zx1528')
expect(page).to have_css '#map'
expect(page).to have_css '[data-embed-url]'
expect(page).to have_css '[data-protocol="Oembed"]'
end
end

0 comments on commit ac44356

Please sign in to comment.