diff --git a/app/assets/javascripts/admins.js b/app/assets/javascripts/admins.js
index f2db3fe8..f8f342bc 100644
--- a/app/assets/javascripts/admins.js
+++ b/app/assets/javascripts/admins.js
@@ -134,6 +134,17 @@ function changePrivacyPolicyURL(path) {
$.post(path, {value: url})
}
+// Display the maintenance Banner
+function displayMaintenanceBanner(path) {
+ var message = $("#maintenance-banner").val()
+ $.post(path, {value: message})
+}
+
+// Clear the maintenance Banner
+function clearMaintenanceBanner(path) {
+ $.post(path, {value: ""})
+}
+
function mergeUsers() {
let userToMerge = $("#from-uid").text()
$.post($("#merge-save-access").data("path"), {merge: userToMerge})
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 48d44c02..32f192a3 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -145,6 +145,10 @@ input:focus {
border-color: $primary !important;
}
+.input-group button:focus {
+ box-shadow: none !important;
+}
+
.list-group-item-action.active {
color: $primary;
}
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index f3b4f30a..f4d06176 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -84,9 +84,9 @@ class ApplicationController < ActionController::Base
help: I18n.t("errors.maintenance.help"),
}
end
- if Rails.configuration.maintenance_window.present?
- unless cookies[:maintenance_window] == Rails.configuration.maintenance_window
- flash.now[:maintenance] = Rails.configuration.maintenance_window
+ if @settings.get_value("Maintenance Banner").present?
+ unless cookies[:maintenance_window] == @settings.get_value("Maintenance Banner")
+ flash.now[:maintenance] = @settings.get_value("Maintenance Banner")
end
end
end
diff --git a/app/helpers/theming_helper.rb b/app/helpers/theming_helper.rb
index 527dd260..b1a28205 100644
--- a/app/helpers/theming_helper.rb
+++ b/app/helpers/theming_helper.rb
@@ -36,4 +36,8 @@ module ThemingHelper
def user_color
@settings.get_value("Primary Color") || Rails.configuration.primary_color_default
end
+
+ def maintenance_banner
+ @settings.get_value("Maintenance Banner")
+ end
end
diff --git a/app/views/admins/components/_settings.html.erb b/app/views/admins/components/_settings.html.erb
index 17c6e8a6..902ad359 100644
--- a/app/views/admins/components/_settings.html.erb
+++ b/app/views/admins/components/_settings.html.erb
@@ -203,6 +203,21 @@
+
<% if current_user.has_role? :super_admin%>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a7531e33..8f6e6f9f 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -82,6 +82,12 @@ en:
info: Set the default recording visbility for new recordings
title: Recording Default Visibility
warning: This setting will only be applied to rooms that aren't running
+ maintenance_banner:
+ info: Displays a Banner to inform the user of a scheduled maintenance
+ title: Maintenance Banner
+ display: Set
+ clear: Clear
+ time: "Maintenance: On Friday, there may be disruptions in service starting at 6 p.m."
registration:
info: Change the way that users register to the website
title: Registration Method
@@ -106,7 +112,7 @@ en:
demoted: User has been successfully demoted
invite: Invite successfully sent to %{email}
invite_email_verification: Emails must be enabled in order to use this method. Please contact your system administrator.
- merge_fail: There was an issue merging the user accounts. Please check the users selected and try again
+ merge_fail: There was an issue merging the user accounts. Please check the users selected and try again
merge_success: User accounts merged successfully
perm_deleted: User has been permanently deleted
promoted: User has been successfully promoted
@@ -136,7 +142,7 @@ en:
edit_site_settings: Allow users with this role to edit site settings
edit_roles: Allow users with this role to edit other roles
manage_users: Allow users with this role to manage users
- invalid_assignment: There was a problem assigning the roles to the user. Please check the values and try again
+ invalid_assignment: There was a problem assigning the roles to the user. Please check the values and try again
colour:
title: Role Colour
info: Set the colour that will be associated with the role
@@ -474,7 +480,7 @@ en:
fail: Your account has not been approved yet. If multiples days have passed since you signed up, please contact your administrator.
signup: Your account was successfully created. It has been sent to an administrator for approval.
banned:
- fail: You do not have access to this application. If you believe this is a mistake, please contact your administrator.
+ fail: You do not have access to this application. If you believe this is a mistake, please contact your administrator.
deprecated:
new_signin: Select a new login method for you account. All your rooms from your old account will be migrated to the new account
twitter_signin: Signing in via Twitter has been deprecated and will be removed in the next release. Click
here to move your account to a new authentication method
diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb
index bace5761..978e1fc9 100644
--- a/spec/controllers/admins_controller_spec.rb
+++ b/spec/controllers/admins_controller_spec.rb
@@ -461,6 +461,24 @@ describe AdminsController, type: :controller do
end
end
+ context "POST #maintenance_banner" do
+ it "displays a banner with the maintenance string" do
+ allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
+ allow_any_instance_of(User).to receive(:greenlight_account?).and_return(true)
+
+ @request.session[:user_id] = @admin.id
+ fake_banner_string = "Maintenance work at 2 pm"
+
+ post :update_settings, params: { setting: "Maintenance Banner", value: fake_banner_string }
+
+ feature = Setting.find_by(provider: "provider1").features.find_by(name: "Maintenance Banner")
+
+ expect(flash[:success]).to be_present
+ expect(feature[:value]).to eq(fake_banner_string)
+ expect(response).to redirect_to(admin_site_settings_path)
+ end
+ end
+
context "POST #shared_access" do
it "changes the shared access setting" do
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)