[bbb-greenlight: 7/39] Added back ability to set maintenance window through env variables (#2089)
- From: Bartłomiej Piotrowski <bpiotrowski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bbb-greenlight: 7/39] Added back ability to set maintenance window through env variables (#2089)
- Date: Thu, 15 Oct 2020 07:11:22 +0000 (UTC)
commit ca94ac46bafffddde13c09f69f9f807eddc8ea84
Author: Ahmad Farhat <ahmad af farhat gmail com>
Date: Tue Sep 15 13:37:58 2020 -0400
Added back ability to set maintenance window through env variables (#2089)
app/controllers/application_controller.rb | 8 +++---
.../site_settings/_administration.html.erb | 30 +++++++++++-----------
2 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6c767c2..62cf742 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -84,10 +84,10 @@ class ApplicationController < ActionController::Base
help: I18n.t("errors.maintenance.help"),
}
end
- 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
+
+ maintenance_string = @settings.get_value("Maintenance Banner").presence ||
Rails.configuration.maintenance_window
+ if maintenance_string.present?
+ flash.now[:maintenance] = maintenance_string unless cookies[:maintenance_window] == maintenance_string
end
end
diff --git a/app/views/admins/components/site_settings/_administration.html.erb
b/app/views/admins/components/site_settings/_administration.html.erb
index c5ce08a..f7a21ca 100644
--- a/app/views/admins/components/site_settings/_administration.html.erb
+++ b/app/views/admins/components/site_settings/_administration.html.erb
@@ -14,21 +14,6 @@
%>
<div class="form-group">
- <div class="row mb-2">
- <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>
<div class="row mb-2">
<div class="col-12">
<div class="form-group">
@@ -59,6 +44,21 @@
</div>
<% if show_log_dropdown %>
+ <div class="row mb-2">
+ <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>
<div class="row">
<div class="col-12">
<div class="form-group">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]