-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add version footer - Includes branch or release name, date deployed if in production environment, and title with git sha * Add Hyrax version to footer, link to Hy-C and Hyrax - Three sections for version footer * Adjust html and center all footer menus Co-authored-by: lfarrell <[email protected]>
- Loading branch information
Showing
4 changed files
with
104 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
<%# [hyc-override] Overriding partial in hyrax gem to update homepage %> | ||
<footer id="unc-footer" class="navbar navbar-inverse site-footer"> | ||
<div class="container-fluid"> | ||
<div class="navbar-text"> | ||
<ul class="navbar-nav list-unstyled"> | ||
<li><%= link_to t('hyrax.links.home'), '/' %></li> | ||
<li><%= link_to t('hyrax.links.browse_collections'), main_app.search_catalog_path(f: { human_readable_type_sim: ["Collection"]}) %></li> | ||
<li><%= link_to t('hyrax.links.help'), "https://blogs.lib.unc.edu/cdr" %></li> | ||
<li><%= link_to t('hyrax.links.contact'), "https://blogs.lib.unc.edu/cdr/index.php/contact-us" %></li> | ||
<li><%= link_to t('hyrax.links.library_home'), "https://library.unc.edu" %></li> | ||
<li><%= link_to t('hyrax.links.privacy_policy'), "https://library.unc.edu/privacy-policy" %></li> | ||
<li><%= link_to t('hyrax.links.accessibility'), "https://digitalaccess.unc.edu/report" %></li> | ||
</ul> | ||
<div class="navbar-text text-center"> | ||
<div class="text-center"> | ||
<div> | ||
<ul class="navbar-nav list-unstyled"> | ||
<li><%= link_to t('hyrax.links.home'), '/' %></li> | ||
<li><%= link_to t('hyrax.links.browse_collections'), main_app.search_catalog_path(f: { human_readable_type_sim: ["Collection"]}) %></li> | ||
<li><%= link_to t('hyrax.links.help'), "https://blogs.lib.unc.edu/cdr" %></li> | ||
<li><%= link_to t('hyrax.links.contact'), "https://blogs.lib.unc.edu/cdr/index.php/contact-us" %></li> | ||
<li><%= link_to t('hyrax.links.library_home'), "https://library.unc.edu" %></li> | ||
<li><%= link_to t('hyrax.links.privacy_policy'), "https://library.unc.edu/privacy-policy" %></li> | ||
<li><%= link_to t('hyrax.links.accessibility'), "https://digitalaccess.unc.edu/report" %></li> | ||
</ul> | ||
</div> | ||
<div> | ||
<ul id="unc-version-footer" class="list-unstyled"> | ||
<li title="<%= GIT_SHA %>"><%= link_to("Hy-C #{BRANCH}", "https://github.com/UNC-Libraries/hy-c") %></li> | ||
<li><%= LAST_DEPLOYED %></li> | ||
<li><%= link_to("Hyrax version #{HYRAX_VERSION}", "https://hyrax.samvera.org/") %></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
<%= render '/shared/select_work_type_modal' %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |