diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index eb55fcb8..727e9492 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -15,6 +15,7 @@ @import "partials/_progress_bar"; @import "partials/_record"; @import "partials/_search"; +@import "partials/_shared"; @import "partials/_results"; @import "partials/_typography"; @import "timdexui"; diff --git a/app/assets/stylesheets/partials/_record.scss b/app/assets/stylesheets/partials/_record.scss index 64b2ffc3..b307778e 100644 --- a/app/assets/stylesheets/partials/_record.scss +++ b/app/assets/stylesheets/partials/_record.scss @@ -4,7 +4,6 @@ .access-button { font-weight: $fw-bold; text-align: center; - width: 100%; padding-top: 1rem; padding-bottom: 1rem; .auth-notice { @@ -19,4 +18,41 @@ } } } + .hidden-md { + @media (max-width: $bp-screen-md) { + display: none; + } + & > .access-button { + width: 100%; + } + } + .view-md { + @media (min-width: $bp-screen-md) { + display: none; + } + } + .section-title, + .metadata-link { + margin-top: 1.4em; + } +} + +.return-to-results { + padding: 1.5% 0; + a { + padding: 1.5%; + color: $blue; + text-decoration: none; + &:hover, + &:focus { + background: blue; + color: white; + } + &:before { + font-family: FontAwesome; + font-size: $fs-large; + content: '\f060'; + margin-right: 1rem; + } + } } diff --git a/app/assets/stylesheets/partials/_results.scss b/app/assets/stylesheets/partials/_results.scss index ec308577..f249b552 100644 --- a/app/assets/stylesheets/partials/_results.scss +++ b/app/assets/stylesheets/partials/_results.scss @@ -40,41 +40,6 @@ } } - .data-info { - font-weight: $fw-bold; - font-size: $fs-base; - margin-bottom: 1em; - li:after { - margin: 0 .6rem; - content: " | "; - } - li:last-child:after { - content: ""; - } - .access-restricted:after { - font-family: FontAwesome; - content: "\f023"; - margin-left: 0.8rem; - } - .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; } diff --git a/app/assets/stylesheets/partials/_shared.scss b/app/assets/stylesheets/partials/_shared.scss new file mode 100644 index 00000000..697a8e74 --- /dev/null +++ b/app/assets/stylesheets/partials/_shared.scss @@ -0,0 +1,38 @@ +.result, +.full-record { + .authors { + font-size: $fs-large; + font-weight: $fw-bold; + margin-bottom: 0.6em; + } + + .data-info { + font-weight: $fw-bold; + font-size: $fs-base; + margin-bottom: 1em; + 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; + } + } + } +} diff --git a/app/helpers/record_helper.rb b/app/helpers/record_helper.rb index 9d55b7a5..5f4c44fa 100644 --- a/app/helpers/record_helper.rb +++ b/app/helpers/record_helper.rb @@ -98,6 +98,48 @@ def access_type(metadata) access_right.first['description'] end + def issued_date(dates) + return if dates.blank? || dates&.none? { |date| date['kind'] == 'Issued' } + + # If there is more than one date issued, take the first one. + dates.select { |date| date['kind'] == 'Issued' }&.uniq&.first['value'] + end + + def coverage_date(dates) + return if dates.blank? || dates&.none? { |date| date['kind'] == 'Coverage' } + + # If there is more than one coverage date, take the first one. + dates.select { |date| date['kind'] == 'Coverage' }&.uniq&.first['value'] + end + + def more_info?(metadata) + if issued_date(metadata['dates']) || coverage_date(metadata['dates']) || places(metadata['locations']) || + metadata['provider'] + true + else + false + end + end + + def source_metadata_available?(links) + links&.any? { |link| link['kind'] == 'Download' && link['text'] == 'Source Metadata' } + end + + def source_metadata_link(links) + return if links.blank? + + links.select { |link| link['kind'] == 'Download' && link['text'] == 'Source Metadata' }.first['url'] + end + + def places(locations) + return if locations.blank? + + place_names = locations.select { |location| location['kind'] == 'Place Name' } + return if place_names.blank? + + place_names.map { |place| place['value'] } + end + private def render_kind_value(list) diff --git a/app/views/record/_access_button.html.erb b/app/views/record/_access_button.html.erb index 3f810820..d4bf91c6 100644 --- a/app/views/record/_access_button.html.erb +++ b/app/views/record/_access_button.html.erb @@ -1,6 +1,6 @@ <% return if @record.blank? %> -