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

Commit

Permalink
Show last modified date on object view
Browse files Browse the repository at this point in the history
The last modified date is:
- Only shown on object views (not collections)
- Formatted to YYYY-MM-DD

see: #643
  • Loading branch information
mcritchlow committed Aug 2, 2019
1 parent f4f39e0 commit b49284f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
11 changes: 11 additions & 0 deletions app/views/shared/fields/_last_modified.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<%
if @document["active_fedora_model_ssi"].eql? "DamsObject"
htmlOpen = "<dt>%s</dt><dd>"
htmlClose = '</dd>'
last_modified = Time.zone.parse(@document["system_modified_dtsi"]).strftime("%Y-%m-%d")
htmlOpen %= 'Last Modified'
concat htmlOpen.html_safe
concat "<p>#{last_modified}</p>".html_safe
concat htmlClose.html_safe
end
%>
3 changes: 2 additions & 1 deletion app/views/shared/fields/_show_raw.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<%= render :partial => 'shared/fields/note', :locals => {:type => 'arrangement'}.merge(component) %>
<%= render :partial => 'shared/fields/note', :locals => {:type => 'technical details'}.merge(component) %>
<%= render :partial => 'shared/fields/note', :locals => {:type => 'note'}.merge(component) %>
<%= render :partial => 'shared/fields/note', :locals => {:type => 'related publications'}.merge(component) %>
<%= render :partial => 'shared/fields/note', :locals => {:type => 'related publications'}.merge(component) %>
<%= render :partial => 'shared/fields/related_resource',
:locals => {:collectionDoc => @document, :docType => 'object'}.merge(component) %>
<%= render :partial => 'shared/fields/note', :locals => {:type => 'publication information'}.merge(component) %>
Expand Down Expand Up @@ -92,6 +92,7 @@
<% end %>
<%= render :partial => 'shared/fields/rights_holder', :locals => component %>
<%= render :partial => 'shared/fields/last_modified' %>



Expand Down
7 changes: 6 additions & 1 deletion spec/features/dams_collections_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
@commonName.delete
end

scenario 'should not see a last modified metadata entry' do
visit dams_collections_path("#{@provCollection.pid}")
expect(page).to_not have_selector('dt', text: 'Last Modified')
end

scenario 'should see the related resource with no URI' do
visit dams_collection_path("#{@provCollection.pid}")
expect(page).to have_content('The physical materials are held at UC San Diego Library')
Expand Down Expand Up @@ -182,7 +187,7 @@
expect(page).to have_selector("#collections-image img")
expect(find("#collections-image img")['alt']).to eq('Heavy Metals in the Ocean Insect, Halobates')
end

scenario 'page should have collection image title attribute' do
visit dams_collection_path("#{@provCollection.pid}")
expect(find("#collections-image img")['title']).to eq('Heavy Metals in the Ocean Insect, Halobates')
Expand Down
4 changes: 4 additions & 0 deletions spec/features/dams_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@
expect(page).to have_selector('li', text: 'Test Anatomy')
expect(page).to have_selector('li', text: 'Test Value Anatomy')

# Last Modified
expect(page).to have_selector('dt', text: 'Last Modified')
expect(page).to have_selector('p', text: Time.now.strftime("%Y-%m-%d"))

#Subject Label
expect(page).to_not have_selector('dt', text: 'Lithologies')
expect(page).to have_selector('dt', text: 'Lithology')
Expand Down

0 comments on commit b49284f

Please sign in to comment.