Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show MARC 592 for databases. #124

Merged
merged 1 commit into from
May 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions app/views/catalog/record/_marc_bibliographic.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,9 @@
<%= render_field_from_marc(note_590) %>
<% end %>

<% if document.to_marc["592"] %>
<dt>Note</dt>
<dd>
<% document.to_marc.find_all{|f| ("592") === f.tag}.each do |field| %>
<% field.each do |sub_field| %>
<%= sub_field.value %>
<% end %>
<br/>
<% end %>
</dd>
<% note_592 = get_data_with_label_from_marc(document.to_marc,"Note", '592') %>
<% if note_592.present? && document.is_a_database? %>
<%= render_field_from_marc(note_592) %>
<% end %>

<%- if document.to_marc['690'] and document.to_marc['690']['a'] and document.to_marc['690']['a'].downcase.include?("collection") -%>
Expand Down
14 changes: 14 additions & 0 deletions spec/fixtures/marc_records/marc_metadata_fixtures.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def metadata1
<subfield code="d">2014.</subfield>
<subfield code="e">Accession 2014-1.</subfield>
</datafield>
<datafield tag="592" ind1=" " ind2=" ">
<subfield code="a">A local note</subfield>
<subfield code="b">added to subjects only</subfield>
</datafield>
<datafield tag="600" ind1="1" ind2="0">
<subfield code="a">Arbitrary, Gregory</subfield>
<subfield code="d">1904-1980.</subfield>
Expand Down Expand Up @@ -659,6 +663,16 @@ def unmatched_vernacular_marc_264_fixture
</record>
xml
end
def marc_592_fixture
<<-xml
<record>
<datafield tag="592" ind1=" " ind2=" ">
<subfield code="a">A local note</subfield>
<subfield code="b">added to subjects only</subfield>
</datafield>
</record>
xml
end
def no_fields_fixture
"<record></record>"
end
Expand Down
24 changes: 24 additions & 0 deletions spec/views/catalog/record/_marc_bibliographic.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require "spec_helper"

describe "catalog/record/_marc_bibliographic.html.erb" do
include MarcMetadataFixtures

describe "MARC 592" do
let(:document) { SolrDocument.new(marcxml: marc_592_fixture) }
before do
assign(:document, document)
end
it "should display for databases" do
document.stub(:is_a_database?).and_return(true)
render
expect(rendered).to have_css("dt", text: "Note")
expect(rendered).to have_css("dd", text: "A local note added to subjects only")
end
it "should not display for non-databases" do
document.stub(:is_a_database?).and_return(false)
render
expect(rendered).to_not have_css("dt", text: "Note")
expect(rendered).to_not have_css("dd", text: "A local note added to subjects only")
end
end
end