Skip to content

Commit

Permalink
Merge pull request #871 from psu-libraries/866-alert-banner
Browse files Browse the repository at this point in the history
866 alert banner
  • Loading branch information
jlandiseigsti authored Nov 14, 2024
2 parents ca04f0b + 3343c6c commit 91e718a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ The file `config/settings.local.yml` is not tracked in git.
Currently this is used to add announcements quickly. By adding values such as:
```rb
# Strings
show_annoucements: true
show_announcement: true
announcement:
header: "Announcement header text goes here"
message: "Place your important message here"
```

Expand Down
1 change: 1 addition & 0 deletions app/views/shared/_announcements.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<div class="announcement container-fluid <%= Settings.announcement&.html_class %>">
<div class="row align-items-center">
<div class="col align-content-center alert-warning">
<h3 class="text-center"> <%= sanitize Settings.announcement&.header %></h3>
<p class="text-center mt-2 mb-2 pb-1"><%= sanitize Settings.announcement&.message %></p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/_header.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<header class="<%= page_classes %>">
<%= render partial: 'shared/announcements' if Settings.show_announcements %>
<%= render partial: 'shared/announcements' if Settings.show_announcement %>
<div class="container-fluid">
<div id="shield-and-logo" class="row">
<div class="col-sm-1">
Expand Down
8 changes: 4 additions & 4 deletions spec/integration/announcement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
require 'rails_helper'

RSpec.describe 'Announcement', :js do
context 'when show_announcements is false' do
context 'when show_announcement is false' do
before do
Settings.add_source!(
{
show_announcements: false,
show_announcement: false,
announcement: nil
}
)
Expand All @@ -24,7 +24,7 @@
before do
Settings.add_source!(
{
show_announcements: nil,
show_announcement: nil,
announcement: nil
}
)
Expand All @@ -41,7 +41,7 @@
before do
Settings.add_source!(
{
show_announcements: true,
show_announcement: true,
announcement: {
message: 'ETDA is for cool kids'
}
Expand Down

0 comments on commit 91e718a

Please sign in to comment.