-
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 configurable banner to the top of page (#706)
* Add configurable banner to the top of page Co-authored-by: Bess Sadler <bess@users.noreply.github.com> Co-authored-by: Sean Warren <seanwarren77@users.noreply.github.com> * Update banner partial * Rubocop --------- Co-authored-by: Bess Sadler <bess@users.noreply.github.com> Co-authored-by: Sean Warren <seanwarren77@users.noreply.github.com>
- Loading branch information
1 parent
0af4863
commit 23aee49
Showing
7 changed files
with
69 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#banner { | ||
text-align: center; | ||
background-color: #e1f0fb; | ||
padding: 20px 0px 10px 0px; | ||
border-bottom: #0060a7 solid 2px; | ||
color: #0060a7; | ||
h1 { | ||
font-size: 24px; | ||
font-weight: bold; | ||
} | ||
p { | ||
font-size: 18px; | ||
} | ||
a { | ||
text-decoration: underline; | ||
} | ||
} | ||
|
||
@media all and (max-width: 860px) { | ||
#banner { | ||
padding: 10px 3px 5px 3px; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
*/ | ||
|
||
@import "settings"; | ||
@import "banner"; | ||
@import "header"; | ||
@import "footer"; | ||
@import "bootstrap"; |
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,12 @@ | ||
# frozen_string_literal: true | ||
|
||
require "yaml" | ||
|
||
module BannerHelper | ||
def banner_content | ||
@yaml_data = YAML.load_file("config/banner.yml") | ||
return false if @yaml_data[Rails.env].nil? | ||
@banner_title = @yaml_data[Rails.env]["title"] | ||
@banner_body = @yaml_data[Rails.env]["body"] | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<% if banner_content %> | ||
<div id="banner"> | ||
<h1><%= sanitize @banner_title %></h1> | ||
<p><%= sanitize @banner_body, attributes: %w(href target)%></p> | ||
</div> | ||
<% end %> |
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,16 @@ | ||
--- | ||
development: | ||
title: Welcome to the development site | ||
body: This is a message for development | ||
test: | ||
title: Welcome to the <i>test</i> site | ||
body: This is a <b>test</b> <a href="mailto:fake@princeton.edu">message.</a> | ||
staging: | ||
title: Welcome to TigerData (Staging)! | ||
body: PRDS is proud to share our new website for the management of research data. | ||
qa: | ||
title: Welcome to TigerData (QA)! | ||
body: PRDS is proud to share our new website for the management of research data. | ||
production: | ||
title: Welcome to TigerData! | ||
body: PRDS is proud to share our new website for the management of research data. |
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,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails_helper" | ||
|
||
describe "Website banner", type: :system, js: true do | ||
it "has the banner on the homepage" do | ||
visit "/" | ||
expect(page).to have_css "#banner" | ||
end | ||
end |