Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #109 from ucsdlib/feature/remove_issued_date
Browse files Browse the repository at this point in the history
Removing issue date from display DHH-678
  • Loading branch information
escowles committed May 28, 2015
2 parents 38dee54 + 9a9ce53 commit 3b4e45f
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/helpers/catalog_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def date_list( document )
if dates != nil
dates.each do |txt|
date = JSON.parse(txt)
if date['value']
if date['value'] && date['type'].casecmp("issued") != 0
dateVal += ", " if !dateVal.blank?
dateVal += date['value']
elsif date['beginDate']
Expand All @@ -86,6 +86,7 @@ def date_list( document )
end
end
end
dateVal = dateVal.gsub(/, $/,'') if dateVal
dateVal
end
def is_collection?( document )
Expand Down
4 changes: 2 additions & 2 deletions app/views/catalog/_collection.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<li>
<span><%= auto_link( note['value'].gsub('""', '"') ) %></span>
</li>
<% end %>
<% end %>
<% end %>
<% dateVal = date_list(document) %>
<% if !dateVal.blank? %>
<li>
<span><%= dateVal.gsub('""', '"') %></span>
</li>
<% end %>
<% end %>
</ul>
21 changes: 21 additions & 0 deletions spec/features/dams_collections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,24 @@
expect(page).to have_link('Sample Provenance Collection')
end
end

feature 'Visitor wants to look at the collection search results view with no issued date' do
before do
@unit = DamsUnit.create pid: 'xx48484848', name: "Test Unit", description: "Test Description", code: "tu", uri: "http://example.com/"
@provCollection = DamsProvenanceCollection.create(pid: "uu8056206n", visibility: "public")
@provCollection.damsMetadata.content = File.new('spec/fixtures/damsProvenanceCollection3.rdf.xml').read
@provCollection.save!
solr_index (@provCollection.pid)
end
after do
@provCollection.delete
@unit.delete
end
scenario 'should see the collection result page with no issued date' do
visit catalog_index_path( {:q => "#{@provCollection.pid}"} )
expect(page).to have_selector('h3', :text => 'Heavy Metals in the Ocean Insect, Halobates')
expect(page).to have_selector("ul.dams-search-results-fields:first li span", :text => '1961-1978')
expect(page).to have_no_content('1000-2015')
end

end
50 changes: 50 additions & 0 deletions spec/fixtures/damsProvenanceCollection3.rdf.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<rdf:RDF
xmlns:mads="http://www.loc.gov/mads/rdf/v1#"
xmlns:damsid="http://library.ucsd.edu/ark:/20775/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:dams="http://library.ucsd.edu/ontology/dams#">
<dams:ProvenanceCollection rdf:about="http://library.ucsd.edu/ark:/20775/uu8056206n">
<dams:typeOfResource>still image</dams:typeOfResource>
<dams:date>
<dams:Date>
<dams:type>collected</dams:type>
<rdf:value>1961-1978</rdf:value>
<dams:encoding>w3cdtf</dams:encoding>
<dams:beginDate>1961</dams:beginDate>
<dams:endDate>1978</dams:endDate>
</dams:Date>
</dams:date>

<dams:typeOfResource>text</dams:typeOfResource>
<dams:date>
<dams:Date>
<dams:type>issued</dams:type>
<dams:encoding>w3cdtf</dams:encoding>
<rdf:value>1000-2015</rdf:value>
</dams:Date>
</dams:date>
<dams:unit rdf:resource="http://library.ucsd.edu/ark:/20775/xx48484848"/>

<dams:visibility>public</dams:visibility>

<dams:note>
<dams:Note>
<rdf:value>Cheng, Lanna; Schulz-Baldes, Meinhard; Alexander, George V; Franco, Paul J; Ott, John (2015): Heavy Metals in the Ocean Insect, Halobates. UC San Diego Library Digital Collections. http://dx.doi.org/10.6075/J06Q1V5H</rdf:value>
<dams:type>preferred citation</dams:type>
</dams:Note>
</dams:note>
<dams:typeOfResource>data</dams:typeOfResource>
<dams:title>
<mads:Title>
<mads:authoritativeLabel>Heavy Metals in the Ocean Insect, Halobates</mads:authoritativeLabel>
<mads:elementList rdf:parseType="Collection">
<mads:MainTitleElement>
<mads:elementValue>Heavy Metals in the Ocean Insect, Halobates</mads:elementValue>
</mads:MainTitleElement>
</mads:elementList>
</mads:Title>
</dams:title>

</dams:ProvenanceCollection>
</rdf:RDF>

0 comments on commit 3b4e45f

Please sign in to comment.