Skip to content

Commit

Permalink
Merge pull request #1392 from mlibrary/DEEPBLUE-208-update-masthead-b…
Browse files Browse the repository at this point in the history
…anner

DEEPBLUE-208 - Update masthead banner
  • Loading branch information
fritzfreiheit authored Feb 16, 2023
2 parents ffd2d59 + 5115838 commit 69dd30f
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 71 deletions.
11 changes: 9 additions & 2 deletions app/assets/stylesheets/custom_layout/tweaks.css
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,13 @@ table.datatable thead th.no-sort {
font-style: italic;
}

.update-alert--std {
background-color : rgb(235, 255, 241);
border-bottom: 0px;
color: black;
text-align: center;
}

.update-alert--warning-std {
background-color : #FFF1EB;
border-bottom: 0px;
Expand All @@ -687,8 +694,8 @@ table.datatable thead th.no-sort {
}

.banner-content-std {
background-color: #FFF1EB;
border-bottom: 2px solid rgb(231, 117, 4);
background-color: rgb(235, 255, 241);
border-bottom: 2px solid rgb(235, 255, 241);
}

.update-alert--warning {
Expand Down
78 changes: 18 additions & 60 deletions app/views/_masthead_announcement.html.erb
Original file line number Diff line number Diff line change
@@ -1,95 +1,53 @@
<% ::Deepblue::ThreadedVarService.ensure_i18n_templates_are_fresh %>
<% if Flipflop.display_masthead_banner_standard? && Flipflop.disable_desposits_and_edits? %>
<% icon_displayed = false %>
<% icon_svg_url = 'http://www.w3.org/2000/svg' %>
<% icon_path = 'M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z' %>
<% warning_icon = "<m-icon innerhtml=\"<svg xmlns=&quot;#{icon_svg_url}&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;#{icon_path}&quot;/></svg>\" class=\"hydrated\"><svg xmlns=\"#{icon_svg_url}\" width=\"16\" height=\"16\" fill=\"currentColor\" viewBox=\"0 0 24 24\"><path d=\"#{icon_path}\"></path></svg></m-icon>" %>
<% if Flipflop.display_masthead_banner_standard? %>
<div class="row ribbon-content banner-content-std">
<div class="update-alert-container">
<section class="update-alert--warning-std container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.standard_html" ) %>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
</section>
</div>
</div>
<% elsif Flipflop.display_masthead_banner_standard? %>
<div class="row ribbon-content banner-content-std">
<div class="update-alert-container">
<section class="update-alert--warning-std container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<section class="update-alert--std container-fluid">
<%= t( "hyrax.masthead_banner.standard_html" ) %>
</section>
</div>
</div>
<% end %>
<% if Flipflop.display_masthead_banner_maintenance? && Flipflop.disable_desposits_and_edits? %>
<% if Flipflop.display_masthead_banner_maintenance? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">

<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.maintenance_html" ) %>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
</section>
</div>
</div>
<% elsif Flipflop.display_masthead_banner_maintenance? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.maintenance_html" ) %>
<%= raw(warning_icon) if !icon_displayed %><% icon_displayed = true %>
<%= t( "hyrax.masthead_banner.maintenance_html" ) %>
</section>
</div>
</div>
<% end %>
<% if Flipflop.display_masthead_banner_slow? && Flipflop.disable_desposits_and_edits? %>
<% if Flipflop.display_masthead_banner_slow? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.slow_html" ) %>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
</section>
</div>
</div>
<% elsif Flipflop.display_masthead_banner_slow? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.slow_html" ) %>
<%= raw(warning_icon) if !icon_displayed %><% icon_displayed = true %>
<%= t( "hyrax.masthead_banner.slow_html" ) %>
</section>
</div>
</div>
<% end %>
<% if Flipflop.display_masthead_banner_outage? && Flipflop.disable_desposits_and_edits? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.outage_banner_html" ) %>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
</section>
</div>
</div>
<% elsif Flipflop.display_masthead_banner_outage? %>
<% if Flipflop.display_masthead_banner_outage? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.outage_banner_html" ) %>
<%= raw(warning_icon) if !icon_displayed %><% icon_displayed = true %>
<%= t( "hyrax.masthead_banner.outage_banner_html" ) %>
</section>
</div>
</div>
<% end %>
<% if Flipflop.disable_desposits_and_edits? && !Flipflop.display_masthead_banner_outage? && !Flipflop.display_masthead_banner_slow? && !Flipflop.display_masthead_banner_maintenance? && !Flipflop.display_masthead_banner_standard? %>
<% if Flipflop.disable_desposits_and_edits? %>
<div class="row ribbon-content banner-content">
<div class="update-alert-container">
<section class="update-alert--warning container-fluid">
<m-icon innerhtml="<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; role=&quot;presentation&quot; width=&quot;16&quot; height=&quot;16&quot; fill=&quot;currentColor&quot; viewBox=&quot;0 0 24 24&quot;><path d=&quot;M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z&quot;/></svg>" class="hydrated"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 24 24"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></svg></m-icon>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
<%= raw(warning_icon) if !icon_displayed %><% icon_displayed = true %>
<%= t( "hyrax.masthead_banner.access_banner_html" ) %>
</section>
</div>
</div>
Expand Down
52 changes: 43 additions & 9 deletions spec/views/_masthead_announcement.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

RSpec.describe '/_masthead_announcement.html.erb', type: :view, skip: false do

let( :section_class ) { '<section class="update-alert--warning container-fluid">' }
let( :section_std_class ) { '<section class="update-alert--warning-std container-fluid">' }
let( :section_std_class ) { '<section class="update-alert--std container-fluid">' }
let( :section_warning_class ) { '<section class="update-alert--warning container-fluid">' }
let( :section_warning_std_class ) { '<section class="update-alert--warning-std container-fluid">' }

before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
end

context 'no banner flipflops set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return false
Expand All @@ -19,8 +20,9 @@

it 'renders no banner sections' do
render
expect(rendered.scan(section_class).size).to eq 1
expect(rendered.scan(section_std_class).size).to eq 0
expect(rendered.scan(section_warning_class).size).to eq 0
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).not_to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.slow_html" )
Expand All @@ -31,6 +33,7 @@

context 'standard banner flipflop set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return false
Expand All @@ -39,8 +42,31 @@

it 'renders the banner section' do
render
expect(rendered.scan(section_class).size).to eq 0
expect(rendered.scan(section_std_class).size).to eq 1
expect(rendered.scan(section_warning_class).size).to eq 0
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.slow_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.outage_banner_html" )
end

end

context 'standard banner flipflop set and read only' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_outage?).and_return false
end

it 'renders the banner section' do
render
expect(rendered.scan(section_std_class).size).to eq 1
expect(rendered.scan(section_warning_class).size).to eq 1
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.slow_html" )
Expand All @@ -51,6 +77,7 @@

context 'maintenance banner flipflop set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return false
Expand All @@ -59,8 +86,9 @@

it 'renders the banner section' do
render
expect(rendered.scan(section_class).size).to eq 1
expect(rendered.scan(section_std_class).size).to eq 0
expect(rendered.scan(section_warning_class).size).to eq 2
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).not_to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.slow_html" )
Expand All @@ -71,6 +99,7 @@

context 'slow banner flipflop set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return true
Expand All @@ -79,8 +108,9 @@

it 'renders the banner section' do
render
expect(rendered.scan(section_class).size).to eq 1
expect(rendered.scan(section_std_class).size).to eq 0
expect(rendered.scan(section_warning_class).size).to eq 2
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).not_to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).to include t( "hyrax.masthead_banner.slow_html" )
Expand All @@ -91,6 +121,7 @@

context 'outage banner flipflop set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return false
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return false
Expand All @@ -99,8 +130,9 @@

it 'renders the banner section' do
render
expect(rendered.scan(section_class).size).to eq 1
expect(rendered.scan(section_std_class).size).to eq 0
expect(rendered.scan(section_warning_class).size).to eq 2
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).not_to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).not_to include t( "hyrax.masthead_banner.slow_html" )
Expand All @@ -111,6 +143,7 @@

context 'all banners flipflop set' do
before do
allow(Flipflop).to receive(:disable_desposits_and_edits?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_standard?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_maintenance?).and_return true
allow(Flipflop).to receive(:display_masthead_banner_slow?).and_return true
Expand All @@ -119,8 +152,9 @@

it 'renders the banner section' do
render
expect(rendered.scan(section_class).size).to eq 3
expect(rendered.scan(section_std_class).size).to eq 1
expect(rendered.scan(section_warning_class).size).to eq 4
expect(rendered.scan(section_warning_std_class).size).to eq 0
expect(rendered).to include t( "hyrax.masthead_banner.standard_html" )
expect(rendered).to include t( "hyrax.masthead_banner.maintenance_html" )
expect(rendered).to include t( "hyrax.masthead_banner.slow_html" )
Expand Down

0 comments on commit 69dd30f

Please sign in to comment.