diff --git a/app/assets/stylesheets/_banner.scss b/app/assets/stylesheets/_banner.scss new file mode 100644 index 00000000..a3445306 --- /dev/null +++ b/app/assets/stylesheets/_banner.scss @@ -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; + } + } \ No newline at end of file diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 7faf156b..6658fb54 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -12,6 +12,7 @@ */ @import "settings"; +@import "banner"; @import "header"; @import "footer"; @import "bootstrap"; diff --git a/app/helpers/banner_helper.rb b/app/helpers/banner_helper.rb new file mode 100644 index 00000000..dc6c0753 --- /dev/null +++ b/app/helpers/banner_helper.rb @@ -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 diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a5663475..58ef766b 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -27,6 +27,7 @@ + <%= render partial: 'shared/banner' %> <%= render partial: 'shared/header' %>
<% if flash[:alert] %> diff --git a/app/views/shared/_banner.html.erb b/app/views/shared/_banner.html.erb new file mode 100644 index 00000000..9081103a --- /dev/null +++ b/app/views/shared/_banner.html.erb @@ -0,0 +1,6 @@ +<% if banner_content %> + +<% end %> \ No newline at end of file diff --git a/config/banner.yml b/config/banner.yml new file mode 100644 index 00000000..08afa773 --- /dev/null +++ b/config/banner.yml @@ -0,0 +1,16 @@ +--- +development: + title: Welcome to the development site + body: This is a message for development +test: + title: Welcome to the test site + body: This is a test message. +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. \ No newline at end of file diff --git a/spec/system/banner_spec.rb b/spec/system/banner_spec.rb new file mode 100644 index 00000000..2317cfa2 --- /dev/null +++ b/spec/system/banner_spec.rb @@ -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