mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 02:50:00 +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:
parent
b5208081b3
commit
c27c87911e
|
@ -1,9 +1,5 @@
|
|||
<div class="container">
|
||||
{{#if Discourse.isReadOnly}}
|
||||
<div class="row">
|
||||
<div class="alert alert-info">{{i18n "read_only_mode.enabled"}}</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{Discourse.globalNotice}}
|
||||
<div class="row">
|
||||
<div class="full-width">
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<div class='container'>
|
||||
{{customHTML "top"}}
|
||||
{{#if Discourse.isReadOnly}}
|
||||
<div class="alert alert-info">{{i18n "read_only_mode.enabled"}}</div>
|
||||
{{/if}}
|
||||
{{Discourse.globalNotice}}
|
||||
</div>
|
||||
|
||||
<div class='list-controls'>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<div class='container'>
|
||||
{{customHTML "top"}}
|
||||
{{#if Discourse.isReadOnly}}
|
||||
<div class="alert alert-info">{{i18n "read_only_mode.enabled"}}</div>
|
||||
{{/if}}
|
||||
{{Discourse.globalNotice}}
|
||||
</div>
|
||||
|
||||
{{#if postStream.loaded}}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<div class='container'>
|
||||
{{customHTML "top"}}
|
||||
{{#if Discourse.isReadOnly}}
|
||||
<div class="alert alert-info">{{i18n "read_only_mode.enabled"}}</div>
|
||||
{{/if}}
|
||||
{{Discourse.globalNotice}}
|
||||
</div>
|
||||
|
||||
{{#unless loading}}
|
||||
|
|
|
@ -848,6 +848,8 @@ en:
|
|||
suppress_uncategorized_badge: "Don't show the badge for uncategorized topics in topic lists"
|
||||
min_posts_for_search_in_topic: "Disable search within topic if topics have less than minimum number posts"
|
||||
|
||||
global_notice: "Display a global banner to all users of the site, change to blank to hide it (HTML is allowed)"
|
||||
|
||||
enable_names: "Allow users to show their full names"
|
||||
display_name_on_posts: "Also show a user's full name on their posts"
|
||||
invites_shown: "Maximum invites shown on a user page"
|
||||
|
|
|
@ -476,6 +476,10 @@ uncategorized:
|
|||
sequential_replies_threshold: 2
|
||||
dominating_topic_minimum_percent: 20
|
||||
|
||||
global_notice:
|
||||
default: ""
|
||||
client: true
|
||||
|
||||
# Category IDs
|
||||
lounge_category_id:
|
||||
default: -1
|
||||
|
|
Loading…
Reference in New Issue
Block a user