diff --git a/app/assets/stylesheets/unc_custom.css.scss b/app/assets/stylesheets/unc_custom.css.scss index c6b52af0f..686c1d374 100644 --- a/app/assets/stylesheets/unc_custom.css.scss +++ b/app/assets/stylesheets/unc_custom.css.scss @@ -309,9 +309,11 @@ div.person { } .site-footer, .social { - height: 30px; + height: auto; } + + #unc-footer { background-color: $carolina-blue-dark; @@ -322,18 +324,33 @@ div.person { width: 100%; } + a { + color: $text-color; + } + ul { + margin: auto; + li { + color: $text-color; display: inline-block; margin: -10px 0 0 15px; padding-right: 15px; border-right: 1px solid $text-color; + &:first-child { + margin-left: 0; + } + &:last-child { border-right: none; } } } + + #unc-version-footer { + margin-top: 15px; + } } div.unc-modal { @@ -701,6 +718,10 @@ li { padding-top: 10px; border-right: none; } + + #unc-version-footer { + margin-top: auto; + } } #unc-featured { @@ -863,6 +884,7 @@ li { #unc-footer { ul li { display: block; + margin-left: 0; margin-top: 5px; } } @@ -913,8 +935,7 @@ li { } ul.navbar-nav { - margin-top: 8px; - padding-left: 20px; + margin: 8px auto; } } @@ -1001,4 +1022,4 @@ li { display: block !important; } } -} \ No newline at end of file +} diff --git a/app/views/shared/_footer.html.erb b/app/views/shared/_footer.html.erb index 7be95e8f0..1f3b81430 100644 --- a/app/views/shared/_footer.html.erb +++ b/app/views/shared/_footer.html.erb @@ -1,17 +1,26 @@ <%# [hyc-override] Overriding partial in hyrax gem to update homepage %> <%= render '/shared/select_work_type_modal' %> diff --git a/config/initializers/git_sha.rb b/config/initializers/git_sha.rb new file mode 100644 index 000000000..a06d0aaa2 --- /dev/null +++ b/config/initializers/git_sha.rb @@ -0,0 +1,18 @@ +GIT_SHA = `git rev-parse HEAD`.chomp +BRANCH = `git rev-parse --abbrev-ref HEAD`.chomp +Rails.logger.debug("in initializer: #{Rails.env}") +LAST_DEPLOYED = if Rails.env.production? + # on cdr-test this returns /net/deploy/ir/test/releases/DEPLOY_DATE + # e.g. /net/deploy/ir/test/releases/20211202095413 + directory_name = `pwd -P`.chomp + deploy_date = directory_name.match(/\d+/).try(:[], 0) + begin + Date.parse(deploy_date).strftime("Deployed on %B %-d, %Y") + rescue ArgumentError, TypeError + "Cannot determine deploy date" + end + else + "Not in deployed environment" + end + +HYRAX_VERSION = Gem.loaded_specs["hyrax"].version.to_s diff --git a/spec/features/footer_spec.rb b/spec/features/footer_spec.rb new file mode 100644 index 000000000..96840ff2d --- /dev/null +++ b/spec/features/footer_spec.rb @@ -0,0 +1,40 @@ +require "rails_helper" + +RSpec.feature 'custom shared footer' do + before do + visit "/" + end + + it "displays the version footer" do + expect(page).to have_css("#unc-version-footer") + end + + it "has the Hyrax version from the gemfile" do + expect(page).to have_link("Hyrax version", href: "https://hyrax.samvera.org/") + expect(page).to have_link("Hy-C") + end + + context "in the development environment" do + before do + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development")) + end + + it "displays that it's not in a deployed environment" do + expect(page).to have_content("Not in deployed environment") + end + end + + context "in a deployed environment" do + before do + Rails.logger.debug("in test 'before' block, before 'allow': #{Rails.env}") + allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production")) + Rails.logger.debug("in test 'before' block, after 'allow': #{Rails.env}") + end + + it "displays data based on the directory it's in" do + pending("Cannot mock production environment in initializer") + Rails.logger.debug("in test 'it' block: #{Rails.env}") + expect(page).to have_content("Deployed some_date") + end + end +end