From dfe9f70747791bc1d0e211f2d483d3d42ac2d3d2 Mon Sep 17 00:00:00 2001
From: Sam
Date: Mon, 13 Nov 2017 15:59:51 +1100
Subject: [PATCH] UX: warn that something must be selected with safe mode
---
app/controllers/safe_mode_controller.rb | 1 +
app/views/safe_mode/index.html.erb | 11 ++++++++---
config/locales/server.en.yml | 1 +
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/app/controllers/safe_mode_controller.rb b/app/controllers/safe_mode_controller.rb
index 864d8408f7c..0a0b6ab4ed1 100644
--- a/app/controllers/safe_mode_controller.rb
+++ b/app/controllers/safe_mode_controller.rb
@@ -14,6 +14,7 @@ class SafeModeController < ApplicationController
if safe_mode.length > 0
redirect_to path("/?safe_mode=#{safe_mode.join("%2C")}")
else
+ flash[:must_select] = true
redirect_to safe_mode_path
end
end
diff --git a/app/views/safe_mode/index.html.erb b/app/views/safe_mode/index.html.erb
index 4908bf23b3e..4a9700cf9a4 100644
--- a/app/views/safe_mode/index.html.erb
+++ b/app/views/safe_mode/index.html.erb
@@ -6,24 +6,29 @@
<%= submit_tag t('safe_mode.enter'), class: 'btn btn-danger' %>
+ <%- if flash[:must_select] %>
+
+ <%= t 'safe_mode.must_select' %>
+
+ <%- end %>
<% end %>
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 2809c813b37..c6649fd47a1 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -3503,6 +3503,7 @@ en:
only_official: "Disable unofficial plugins"
no_plugins: "Disable all plugins"
enter: "Enter Safe Mode"
+ must_select: "You must select at least one option to enter safe mode."
wizard:
title: "Discourse Setup"
step: