forked from External/greenlight
Maintenance banner moved to admin site (#1775)
* initial * finish * travis fixes * travis again * not required
This commit is contained in:
parent
495c375685
commit
9a96df6a37
|
@ -134,6 +134,17 @@ function changePrivacyPolicyURL(path) {
|
||||||
$.post(path, {value: url})
|
$.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() {
|
function mergeUsers() {
|
||||||
let userToMerge = $("#from-uid").text()
|
let userToMerge = $("#from-uid").text()
|
||||||
$.post($("#merge-save-access").data("path"), {merge: userToMerge})
|
$.post($("#merge-save-access").data("path"), {merge: userToMerge})
|
||||||
|
|
|
@ -145,6 +145,10 @@ input:focus {
|
||||||
border-color: $primary !important;
|
border-color: $primary !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.input-group button:focus {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
.list-group-item-action.active {
|
.list-group-item-action.active {
|
||||||
color: $primary;
|
color: $primary;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,9 @@ class ApplicationController < ActionController::Base
|
||||||
help: I18n.t("errors.maintenance.help"),
|
help: I18n.t("errors.maintenance.help"),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
if Rails.configuration.maintenance_window.present?
|
if @settings.get_value("Maintenance Banner").present?
|
||||||
unless cookies[:maintenance_window] == Rails.configuration.maintenance_window
|
unless cookies[:maintenance_window] == @settings.get_value("Maintenance Banner")
|
||||||
flash.now[:maintenance] = Rails.configuration.maintenance_window
|
flash.now[:maintenance] = @settings.get_value("Maintenance Banner")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,4 +36,8 @@ module ThemingHelper
|
||||||
def user_color
|
def user_color
|
||||||
@settings.get_value("Primary Color") || Rails.configuration.primary_color_default
|
@settings.get_value("Primary Color") || Rails.configuration.primary_color_default
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def maintenance_banner
|
||||||
|
@settings.get_value("Maintenance Banner")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -203,6 +203,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-6 row">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="form-label"><%= t("administrator.site_settings.maintenance_banner.title") %></label>
|
||||||
|
<label class="form-label text-muted"><%= t("administrator.site_settings.maintenance_banner.info") %></label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="maintenance-banner" type="text" class="form-control" value="<%= maintenance_banner %>" placeholder="<%= t("administrator.site_settings.maintenance_banner.time") %>">
|
||||||
|
<span class="input-group-append">
|
||||||
|
<button onclick="displayMaintenanceBanner('<%= admin_update_settings_path(setting: 'Maintenance Banner') %>')" class="settings-button btn btn-primary" type="button"><%= t("administrator.site_settings.maintenance_banner.display") %></button>
|
||||||
|
<button onclick="clearMaintenanceBanner('<%= admin_update_settings_path(setting: 'Maintenance Banner') %>')" class="settings-button btn btn-danger" type="button"><%= t("administrator.site_settings.maintenance_banner.clear") %></button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% if current_user.has_role? :super_admin%>
|
<% if current_user.has_role? :super_admin%>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -82,6 +82,12 @@ en:
|
||||||
info: Set the default recording visbility for new recordings
|
info: Set the default recording visbility for new recordings
|
||||||
title: Recording Default Visibility
|
title: Recording Default Visibility
|
||||||
warning: This setting will only be applied to rooms that aren't running
|
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:
|
registration:
|
||||||
info: Change the way that users register to the website
|
info: Change the way that users register to the website
|
||||||
title: Registration Method
|
title: Registration Method
|
||||||
|
|
|
@ -461,6 +461,24 @@ describe AdminsController, type: :controller do
|
||||||
end
|
end
|
||||||
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
|
context "POST #shared_access" do
|
||||||
it "changes the shared access setting" do
|
it "changes the shared access setting" do
|
||||||
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
|
allow(Rails.configuration).to receive(:loadbalanced_configuration).and_return(true)
|
||||||
|
|
Loading…
Reference in New Issue