-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1208 from sul-dlss/1051-virtual-objects
Add virtual object support
- Loading branch information
Showing
30 changed files
with
377 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## | ||
# A mixin to add set member behavior to SolrDocuments. | ||
# Items that are in a set identify their set membership | ||
# by indexing their set's identifier in the set field. | ||
module SolrSet | ||
def set_member? | ||
self[:set].present? | ||
end | ||
|
||
def parent_sets | ||
return unless set_member? | ||
@parent_sets ||= set_document_list.map do |doc| | ||
SolrDocument.new(doc) | ||
end | ||
end | ||
|
||
# Used for generating simple title links to the parent sets w/o making a Solr request | ||
def index_parent_sets | ||
return unless set_member? && self[:set_with_title].present? | ||
@index_parent_sets ||= self[:set_with_title].map do |set_with_title| | ||
id, title = set_with_title.split('-|-').map(&:strip) | ||
SolrDocument.new(id: id, title_display: title) | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_document_list | ||
@document_list ||= Blacklight.solr.select(set_solr_params)['response']['docs'] | ||
end | ||
|
||
def set_solr_params | ||
ids = self['set'].map do |set_id| | ||
"id:#{set_id}" | ||
end.join(' OR ') | ||
{ params: { fq: ids } } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<% document ||= @document %> | ||
<% if document.set_member? && document.parent_sets.present? %> | ||
<div class="panel panel-default access-panel panel-appears-in"> | ||
<div class="access-panel-heading panel-heading"> | ||
<h3>Appears in</h3> | ||
</div> | ||
|
||
<div class="panel-body"> | ||
<% @document.parent_sets.each do |parent_set| %> | ||
<h4> | ||
<%= render_resource_icon parent_set[parent_set.format_key] %> | ||
<%= link_to_document(parent_set, get_main_title(parent_set)) %> | ||
</h4> | ||
<% end %> | ||
</div> | ||
</div> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
:id: 47 | ||
:title_display: A Collection of Virtual Objects | ||
:format_main_ssim: "Archive/Manuscript" | ||
:modsxml: <%= mods_everything %> | ||
:collection_type: Digital Collection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
:id: 48 | ||
:title_display: A Virtual Object | ||
:format_main_ssim: Map | ||
:marcxml: <%= metadata2 %> | ||
:marcbib_xml: <%= metadata2 %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- cg767mn6478%2F2542A.jp2 | ||
:druid: hj097bm8879 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
:id: 49 | ||
:title_display: Another Virtual Object | ||
:format_main_ssim: Map | ||
:marcxml: <%= contributed_works_fixture %> | ||
:marcbib_xml: <%= contributed_works_fixture %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- jw923xn5254%2F2542B.jp2 | ||
:druid: hj097bm8879 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
:id: 50 | ||
:title_display: An item in a virtual object | ||
:format_main_ssim: Map | ||
:modsxml: <%= mods_everything %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- wn461xh4882%2F2542001.jp2 | ||
:druid: wn461xh4882 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' | ||
:set: | ||
- '48' | ||
:set_with_title: | ||
- '48 -|- A Virtual Object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
:id: 51 | ||
:title_display: Another item in a virtual object | ||
:format_main_ssim: Map | ||
:marcxml: <%= metadata1 %> | ||
:marcbib_xml: <%= metadata1 %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- fh193nf4583%2F2542002.jp2 | ||
:druid: fh193nf4583 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' | ||
:set: | ||
- '48' | ||
:set_with_title: | ||
- '48 -|- A Virtual Object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
:id: 52 | ||
:title_display: An item in a another virtual object | ||
:format_main_ssim: Map | ||
:marcxml: <%= metadata1 %> | ||
:marcbib_xml: <%= metadata1 %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- zm141bz6672%2F2542003.jp2 | ||
:druid: zm141bz6672 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' | ||
:set: | ||
- '49' | ||
:set_with_title: | ||
- '49 -|- Another Virtual Object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
:id: 53 | ||
:title_display: Another item in a another virtual object | ||
:format_main_ssim: Map | ||
:marcxml: <%= marc_382_instrumentation %> | ||
:marcbib_xml: <%= marc_382_instrumentation %> | ||
:display_type: | ||
- image | ||
:file_id: | ||
- ty335fg4673%2F2542004.jp2 | ||
:druid: ty335fg4673 | ||
:collection: | ||
- '47' | ||
:collection_with_title: | ||
- '47 -|- A Collection of Virtual Objects' | ||
:set: | ||
- '49' | ||
:set_with_title: | ||
- '49 -|- Another Virtual Object' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.