diff --git a/app/assets/javascripts/admin/templates/admin.js.handlebars b/app/assets/javascripts/admin/templates/admin.js.handlebars index 930c697b605..088de2b2b23 100644 --- a/app/assets/javascripts/admin/templates/admin.js.handlebars +++ b/app/assets/javascripts/admin/templates/admin.js.handlebars @@ -1,9 +1,5 @@
- {{#if Discourse.isReadOnly}} -
-
{{i18n "read_only_mode.enabled"}}
-
- {{/if}} + {{Discourse.globalNotice}}
diff --git a/app/assets/javascripts/discourse.js b/app/assets/javascripts/discourse.js index 7a8f523e951..34f87e4c318 100644 --- a/app/assets/javascripts/discourse.js +++ b/app/assets/javascripts/discourse.js @@ -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 "
" + text + "
"; + }).join("")); + } + }.property("isReadOnly") }); diff --git a/app/assets/javascripts/discourse/templates/discovery.js.handlebars b/app/assets/javascripts/discourse/templates/discovery.js.handlebars index a8635ffa634..d77219fdc8a 100644 --- a/app/assets/javascripts/discourse/templates/discovery.js.handlebars +++ b/app/assets/javascripts/discourse/templates/discovery.js.handlebars @@ -1,8 +1,6 @@
{{customHTML "top"}} - {{#if Discourse.isReadOnly}} -
{{i18n "read_only_mode.enabled"}}
- {{/if}} + {{Discourse.globalNotice}}
diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index 74019d6b032..240112738cf 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -1,8 +1,6 @@
{{customHTML "top"}} - {{#if Discourse.isReadOnly}} -
{{i18n "read_only_mode.enabled"}}
- {{/if}} + {{Discourse.globalNotice}}
{{#if postStream.loaded}} diff --git a/app/assets/javascripts/discourse/templates/user/user.js.handlebars b/app/assets/javascripts/discourse/templates/user/user.js.handlebars index 0bcf23cc89a..882f9999c08 100644 --- a/app/assets/javascripts/discourse/templates/user/user.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/user.js.handlebars @@ -1,8 +1,6 @@
{{customHTML "top"}} - {{#if Discourse.isReadOnly}} -
{{i18n "read_only_mode.enabled"}}
- {{/if}} + {{Discourse.globalNotice}}
{{#unless loading}} diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 9ee6ff3245c..791095688af 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -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" diff --git a/config/site_settings.yml b/config/site_settings.yml index 7dea2d5cc63..d9f7a882627 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -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