forked from External/greenlight
Maintenance banner moved to admin site (#1775)
* initial * finish * travis fixes * travis again * not required
This commit is contained in:
@ -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})
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -203,6 +203,21 @@
|
||||
</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%>
|
||||
<hr>
|
||||
<div class="row">
|
||||
|
Reference in New Issue
Block a user