mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
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:
@ -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")
|
||||
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user