-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
866 alert banner #868
Merged
Merged
866 alert banner #868
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,7 @@ | ||
<div class="announcement container-fluid <%= Settings.announcement&.html_class || "yoo doggie" %>"> | ||
<div class="row align-items-center"> | ||
<div class="col align-content-center alert-warning"> | ||
<p class="text-center mt-2 mb-2 pb-1"><%= sanitize Settings.announcement&.message %></p> | ||
</div> | ||
</div> | ||
</div> |
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,56 @@ | ||
# frozen_string_literal: true | ||
|
||
Config.setup do |config| | ||
# Name of the constant exposing loaded settings | ||
config.const_name = 'Settings' | ||
|
||
# Ability to remove elements of the array set in earlier loaded settings file. For example value: '--'. | ||
# | ||
# config.knockout_prefix = nil | ||
|
||
# Overwrite an existing value when merging a `nil` value. | ||
# When set to `false`, the existing value is retained after merge. | ||
# | ||
# config.merge_nil_values = true | ||
|
||
# Overwrite arrays found in previously loaded settings file. When set to `false`, arrays will be merged. | ||
# | ||
# config.overwrite_arrays = true | ||
|
||
# Load environment variables from the `ENV` object and override any settings defined in files. | ||
# | ||
config.use_env = true | ||
|
||
# Define ENV variable prefix deciding which variables to load into config. | ||
# | ||
# Reading variables from ENV is case-sensitive. If you define lowercase value below, ensure your ENV variables are | ||
# prefixed in the same way. | ||
# | ||
# When not set it defaults to `config.const_name`. | ||
# | ||
config.env_prefix = 'SETTINGS' | ||
|
||
# What string to use as level separator for settings loaded from ENV variables. Default value of '.' works well | ||
# with Heroku, but you might want to change it for example for '__' to easy override settings from command line, where | ||
# using dots in variable names might not be allowed (eg. Bash). | ||
# | ||
config.env_separator = '__' | ||
|
||
# Ability to process variables names: | ||
# * nil - no change | ||
# * :downcase - convert to lower case | ||
# | ||
# config.env_converter = :downcase | ||
|
||
# Parse numeric values as integers instead of strings. | ||
# | ||
# config.env_parse_values = true | ||
|
||
# Validate presence and type of specific config values. Check https://github.com/dry-rb/dry-validation for details. | ||
# | ||
# config.schema do | ||
# required(:name).filled | ||
# required(:age).maybe(:int?) | ||
# required(:email).filled(format?: EMAIL_REGEX) | ||
# 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'Announcement', :js do | ||
context 'when show_announcements is false' do | ||
before do | ||
Settings.add_source!( | ||
{ | ||
show_announcements: false, | ||
announcement: nil | ||
} | ||
) | ||
Settings.reload! | ||
end | ||
|
||
it 'does not display an announcement on top' do | ||
visit root_path | ||
expect(page).to have_no_css '.announcement' | ||
end | ||
end | ||
|
||
context 'when show_announcement is nil' do | ||
before do | ||
Settings.add_source!( | ||
{ | ||
show_announcements: nil, | ||
announcement: nil | ||
} | ||
) | ||
Settings.reload! | ||
end | ||
|
||
it 'does not display an announcement on top' do | ||
visit root_path | ||
expect(page).to have_no_css '.announcement' | ||
end | ||
end | ||
|
||
context 'when show_announcement is true' do | ||
before do | ||
Settings.add_source!( | ||
{ | ||
show_announcements: true, | ||
announcement: { | ||
message: 'ETDA is for cool kids' | ||
} | ||
} | ||
) | ||
Settings.reload! | ||
end | ||
|
||
it 'displays the given announcement' do | ||
visit root_path | ||
expect(page).to have_css '.announcement' | ||
expect(page).to have_content 'ETDA is for cool kids' | ||
end | ||
end | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the OR operator needed here? It can just be nil if html_class is not defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha ha, absolutely not necessary. Glad you caught this.
Yes, my plan was to inject the yml from config like in catalog. Planning to try this out in the QA environment.