Unverified Commit ca94ac46 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Added back ability to set maintenance window through env variables (#2089)

parent 83cc7ed3
......@@ -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
......
......@@ -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">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment