diff --git a/app/assets/stylesheets/partials/_results.scss b/app/assets/stylesheets/partials/_results.scss index a730fb0c..2de121ef 100644 --- a/app/assets/stylesheets/partials/_results.scss +++ b/app/assets/stylesheets/partials/_results.scss @@ -14,11 +14,27 @@ .no-results + .ask-us { margin-top: 0rem; } + + #results { + list-style-position: inside; + } } .result { padding: 2rem; border-top: 1px solid $brand-primary; + font-size: $fs-small; + + /* Adding hd-2 styling for order markers to match result titles */ + &::marker { + font-size: $fs-xxlarge; + line-height: $lh-tight; + font-weight: $fw-bold; + } + + .record-title { + display: inline; + } &:hover, &:focus { @@ -32,26 +48,76 @@ } .pub-info { - font-size: $fs-small; + font-size: $fs-base; color: $gray-d1; span:first-child:after { - content: " | "; + content: " | "; } + margin: 1em 0; + } + + .data-info { + font-weight: $fw-bold; + font-size: $fs-base; + margin: 1em 0; + li:after { + margin: 0 .6rem; + content: " | "; + } + li:last-child:after { + content: ""; + } + .access-restricted:after { + font-family: FontAwesome; + content: "\f023"; + margin-left: 0.8rem; + color: $gray-l1; + } + .other-provider { + font-weight: $fw-normal; + } + @media (max-width: $bp-screen-sm) { + li:nth-last-child(2):after { + content: ""; + } + li:last-child { + display: block; + } + } + } + + .result-authors { + font-size: $fs-large; + font-weight: $fw-bold; + margin-bottom: 0.6em; + } + + .result-summary { + margin-bottom: 2.4em; } .result-highlights { - font-size: $fs-small; + margin-top: 1.4em; ul { list-style: none; + li { + margin-left: 2rem; + } } } .result-get { padding-top: 5px; - font-size: 1.4rem; a:visited { color: $white; background-color: green; } } + + .truncate-list { + overflow: hidden; + display: -webkit-box; + -webkit-line-clamp: 3; + -webkit-box-orient: vertical; + } } diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index e72505d3..ab6417c4 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -14,4 +14,46 @@ def view_online(result) link_to 'View online', result['sourceLink'], class: 'button button-primary green' end + + def view_record(record_id) + link_to 'View full record', record_path(id: record_id), class: 'button button-primary green' + end + + # 'Coverage' and 'issued' seem to be the most prevalent types; 'coverage' is typically formatted as + # 'YYYY', whereas 'issued' comes in a variety of formats. + def parse_geo_dates(dates) + relevant_dates = if dates&.any? { |date| date['kind'] == 'Issued' } + dates.select { |date| date['kind'] == 'Issued' }&.uniq + elsif dates&.any? { |date| date['kind'] == 'Coverage' } + dates.select { |date| date['kind'] == 'Coverage' }&.uniq + end + return if relevant_dates.blank? + + # Taking the first date, somewhat arbitrarily, because returning something is likely better than returning nothing. + relevant_date = relevant_dates.first['value'] + + # If the date vaguely resembes a year, return it as is. + return relevant_date if relevant_date.length == 4 + + # If the date vaguely resembles 'YYYY-MM', 12/01/2020, or another unparsable date, extract the year. + handle_unparsable_date(relevant_date) + end + + private + + def handle_unparsable_date(date) + if date.include? '-' + extract_year(date, '-') + elsif date.include? '/' + extract_year(date, '/') + end + end + + def extract_year(date, delimiter) + if date.split(delimiter).first.length == 4 + date.split(delimiter).first + elsif date.split(delimiter).last.length == 4 + date.split(delimiter).last + end + end end diff --git a/app/models/timdex_search.rb b/app/models/timdex_search.rb index 703a9050..3e5e79f7 100644 --- a/app/models/timdex_search.rb +++ b/app/models/timdex_search.rb @@ -57,6 +57,12 @@ class TimdexSearch < TimdexBase kind value } + links { + kind + restrictions + text + url + } notes { kind value @@ -65,7 +71,14 @@ class TimdexSearch < TimdexBase matchedField matchedPhrases } + provider + rights { + kind + description + uri + } sourceLink + summary } aggregations { contentType { @@ -168,6 +181,12 @@ class TimdexSearch < TimdexBase kind value } + links { + kind + restrictions + text + url + } notes { kind value @@ -176,7 +195,14 @@ class TimdexSearch < TimdexBase matchedField matchedPhrases } + provider + rights { + kind + description + uri + } sourceLink + summary } aggregations { contentType { @@ -273,6 +299,12 @@ class TimdexSearch < TimdexBase kind value } + links { + kind + restrictions + text + url + } notes { kind value @@ -281,7 +313,14 @@ class TimdexSearch < TimdexBase matchedField matchedPhrases } + provider + rights { + kind + description + uri + } sourceLink + summary } aggregations { contentType { @@ -388,6 +427,12 @@ class TimdexSearch < TimdexBase kind value } + links { + kind + restrictions + text + url + } notes { kind value @@ -396,7 +441,14 @@ class TimdexSearch < TimdexBase matchedField matchedPhrases } + provider + rights { + kind + description + uri + } sourceLink + summary } aggregations { contentType { diff --git a/app/views/search/_authors.html.erb b/app/views/search/_authors.html.erb new file mode 100644 index 00000000..0c3d34e0 --- /dev/null +++ b/app/views/search/_authors.html.erb @@ -0,0 +1,9 @@ +<%= return if contributors.blank? %> + +<% author_list = [] %> +<% contributors&.each do |contributor| %> + <% author_list << contributor['value'] %> +<% end %> + +Authors: +<%= author_list.uniq.map { |author| link_to author, results_path({ advanced: true, contributors: author }) }.join(' ; ').html_safe %> diff --git a/app/views/search/_geo_data_info.html.erb b/app/views/search/_geo_data_info.html.erb new file mode 100644 index 00000000..21024b77 --- /dev/null +++ b/app/views/search/_geo_data_info.html.erb @@ -0,0 +1,9 @@ + diff --git a/app/views/search/_highlights.html.erb b/app/views/search/_highlights.html.erb index 77354ffb..80377616 100644 --- a/app/views/search/_highlights.html.erb +++ b/app/views/search/_highlights.html.erb @@ -1,8 +1,8 @@ <% highlights = trim_highlights(result) %> <% return unless highlights&.any? %> -

Other fields matching your search terms:

-