FEATURE: refactor notice code, add optional global notice.

Set the global_notice site setting to notify users of a critical event.
This commit is contained in:
Sam
2014-03-24 16:51:48 +11:00
parent b5208081b3
commit c27c87911e
7 changed files with 29 additions and 15 deletions

View File

@ -143,7 +143,25 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
}
}
return this.get("currentAssetVersion");
}.property()
}.property(),
globalNotice: function(){
var notices = [];
if(this.get("isReadOnly")){
notices.push(I18n.t("read_only_mode.enabled"));
}
if(!_.isEmpty(Discourse.SiteSettings.global_notice)){
notices.push(Discourse.SiteSettings.global_notice);
}
if(notices.length > 0) {
return new Handlebars.SafeString(_.map(notices, function(text) {
return "<div class='row'><div class='alert alert-info'>" + text + "</div></div>";
}).join(""));
}
}.property("isReadOnly")
});