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

Separate display date into 'Creation date' and 'Publication date' #6062

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions app/assets/stylesheets/blacklight.scss
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ img.no-icon {
.page-item span.page-link {
color: $dark !important;
}

.blacklight-date_issued_ssi.col-sm-3 {
white-space: nowrap;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Publication date" was too long to display on a single line on the search page with the default css, so override to keep it inline.

}
3 changes: 2 additions & 1 deletion app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ class CatalogController < ApplicationController
# solr fields to be displayed in the index (search results) view
# The ordering of the field names is the order of the display
config.add_index_field 'title_tesi', label: 'Title', if: Proc.new {|context, _field_config, _document| context.request.format == :json }
config.add_index_field 'date_issued_ssi', label: 'Date', helper_method: :combined_display_date
config.add_index_field 'date_issued_ssi', label: 'Publication date'
config.add_index_field 'date_created_ssi', label: 'Creation date'
Comment on lines +116 to +117
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I forgot about the combined dates on search results. This probably also comes up in collection landing page search results.

@joncameron Which dates do you think should be displayed on search results?

config.add_index_field 'creator_ssim', label: 'Main contributors', helper_method: :contributor_index_display
config.add_index_field 'abstract_ssi', label: 'Summary', helper_method: :description_index_display
config.add_index_field 'duration_ssi', label: 'Duration', if: Proc.new {|context, _field_config, _document| context.request.format == :json }
Expand Down
12 changes: 0 additions & 12 deletions app/helpers/media_objects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ def dropbox_url collection
ic.iconv(url)
end

def combined_display_date media_object
(issued,created) = case media_object
when MediaObject, SpeedyAF::Proxy::MediaObject
[media_object.date_issued, media_object.date_created]
when Hash
[media_object[:document]['date_issued_ssi'], media_object[:document]['date_created_ssi']]
end
result = issued
result += " (Creation date: #{created})" if created.present?
result
end

def display_other_identifiers media_object
# bibliographic_id has form [:type,"value"], other_identifier has form [[:type,"value],[:type,"value"],...]
ids = media_object.bibliographic_id.present? ? [media_object.bibliographic_id] : []
Expand Down
3 changes: 2 additions & 1 deletion app/models/iiif_manifest_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ def display_lending_period(media_object)
def iiif_metadata_fields
fields = [
metadata_field('Title', media_object.title, media_object.id),
metadata_field('Date', combined_display_date(media_object), 'Not provided'),
masaball marked this conversation as resolved.
Show resolved Hide resolved
metadata_field('Publication date', media_object.date_issued),
metadata_field('Creation date', media_object.date_created),
metadata_field('Main contributor', media_object.creator),
metadata_field('Summary', display_summary(media_object)),
metadata_field('Contributor', media_object.contributor),
Expand Down
3 changes: 2 additions & 1 deletion app/views/playlist_items/_current_item.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Unless required by applicable law or agreed to in writing, software distributed
</div>

<dl id="creation_metadata">
<%= display_metadata('Date', combined_display_date(@current_mediaobject), 'Not provided') %>
<%= display_metadata('Publication date', @current_mediaobject.date_issued) %>
<%= display_metadata('Creation date', @current_mediaobject.date_created) %>
<%= display_metadata('Main contributor', @current_mediaobject.creator) %>
<% unless @current_mediaobject.abstract.blank? %>
<dt>Summary</dt>
Expand Down
8 changes: 4 additions & 4 deletions spec/models/iiif_manifest_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
it 'provides metadata' do
allow_any_instance_of(IiifManifestPresenter).to receive(:lending_enabled).and_return(false)

['Title', 'Date', 'Main contributor', 'Summary', 'Contributor', 'Publisher', 'Genre', 'Subject', 'Time period',
'Location', 'Collection', 'Unit', 'Language', 'Rights Statement', 'Terms of Use', 'Physical Description', 'Series',
['Title', 'Publication date', 'Creation date', 'Main contributor', 'Summary', 'Contributor', 'Publisher', 'Genre', 'Subject',
'Time period', 'Location', 'Collection', 'Unit', 'Language', 'Rights Statement', 'Terms of Use', 'Physical Description', 'Series',
'Related Item', 'Notes', 'Table of Contents', 'Local Note', 'Other Identifier', 'Access Restrictions', 'Bibliographic ID'
].each do |field|
expect(subject).to include(field)
Expand Down Expand Up @@ -93,8 +93,8 @@
it 'provides metadata' do
allow_any_instance_of(IiifManifestPresenter).to receive(:lending_enabled).and_return(true)

['Title', 'Date', 'Main contributor', 'Summary', 'Contributor', 'Publisher', 'Genre', 'Subject', 'Time period',
'Location', 'Collection', 'Unit', 'Language', 'Rights Statement', 'Terms of Use', 'Physical Description', 'Series',
['Title', 'Publication date', 'Creation date', 'Main contributor', 'Summary', 'Contributor', 'Publisher', 'Genre', 'Subject',
'Time period', 'Location', 'Collection', 'Unit', 'Language', 'Rights Statement', 'Terms of Use', 'Physical Description', 'Series',
'Related Item', 'Notes', 'Table of Contents', 'Local Note', 'Other Identifier', 'Access Restrictions', 'Bibliographic ID', 'Lending Period'
].each do |field|
expect(subject).to include(field)
Expand Down