diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 860e21c40aa..6d6f434a881 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -27,6 +27,10 @@ class StaticController < ApplicationController file = "static/#{page}.en" end + if not lookup_context.find_all("#{file}.html").any? + file = "static/#{page}" + end + if lookup_context.find_all("#{file}.html").any? render file, layout: !request.xhr?, formats: [:html] return diff --git a/app/models/site_content.rb b/app/models/site_content.rb index a247b861bff..1fbcbb5f462 100644 --- a/app/models/site_content.rb +++ b/app/models/site_content.rb @@ -20,6 +20,7 @@ class SiteContent < ActiveRecord::Base add_content_type :login_required_welcome_message, default_18n_key: 'login_required.welcome_message' add_content_type :privacy_policy, allow_blank: true add_content_type :faq, allow_blank: true + add_content_type :login_required, default_18n_key: 'login_required.welcome_message' def site_content_type @site_content_type ||= SiteContent.content_types.find {|t| t.content_type == content_type.to_sym} diff --git a/app/views/static/login.en.html.erb b/app/views/static/login.en.html.erb deleted file mode 100644 index 4971cd49c7c..00000000000 --- a/app/views/static/login.en.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= markdown_content(:login_required_welcome_message) %> diff --git a/app/views/static/login.html.erb b/app/views/static/login.html.erb new file mode 100644 index 00000000000..cf1503c5525 --- /dev/null +++ b/app/views/static/login.html.erb @@ -0,0 +1 @@ +<%= PrettyText.cook(SiteContent.content_for(:login_required)).html_safe %> diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c71b3577f8f..8a46e29e381 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -436,6 +436,9 @@ en: tos_miscellaneous: title: "Terms of Service: Miscellaneous" description: "The text for the Miscellaneous section of the Terms of Service." + login_required: + title: "Login Required: Homepage" + description: "The text displayed for unauthorized users when login is required on the site." site_settings: default_locale: "The default language of this Discourse instance (ISO 639-1 Code)"