add an alert when trying to login while in read-only mode

This commit is contained in:
Régis Hanol 2014-02-13 08:33:40 -08:00
parent 38e365ea45
commit 0e941a6253
3 changed files with 11 additions and 4 deletions

View File

@ -31,7 +31,7 @@ Discourse.addInitializer(function() {
Discourse.MessageBus.subscribe("/global/read-only", function (enabled) {
Discourse.set("isReadOnly", enabled);
if (enabled && !Discourse.User.currentProp("hideReadOnlyAlert")) {
bootbox.alert(I18n.t("read_only_mode_enabled"));
bootbox.alert(I18n.t("read_only_mode.enabled"));
}
});

View File

@ -11,8 +11,12 @@ Discourse.ApplicationRoute = Em.Route.extend({
actions: {
showLogin: function() {
Discourse.Route.showModal(this, 'login');
this.controllerFor('login').resetForm();
if (Discourse.get("isReadOnly")) {
bootbox.alert(I18n.t("read_only_mode.login_disabled"));
} else {
Discourse.Route.showModal(this, 'login');
this.controllerFor('login').resetForm();
}
},
showCreateAccount: function() {

View File

@ -411,7 +411,10 @@ en:
loading: "Loading..."
close: "Close"
assets_changed_confirm: "Discourse has been updated, would you like to refresh to get the latest version?"
read_only_mode_enabled: "An administrator has enabled read-only mode. You can continue to browse the site but interations won't work properly."
read_only_mode:
enabled: "An administrator has enabled read-only mode. You can continue to browse the site but interations won't work properly."
login_disabled: "Login is disabled while the site is in read only mode."
learn_more: "learn more..."
year: 'year'