mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
work in progress, add custom faq link, ember router needs to know about this or the redirect trick will not work
This commit is contained in:
parent
6145e99baa
commit
9fd00cac65
3 changed files with 12 additions and 2 deletions
|
@ -4,10 +4,18 @@ class StaticController < ApplicationController
|
|||
|
||||
def show
|
||||
|
||||
map = {
|
||||
"faq" => "faq_url",
|
||||
"tos" => "tos_url",
|
||||
"privacy" => "privacy_policy_url"
|
||||
}
|
||||
|
||||
page = params[:id]
|
||||
|
||||
return redirect_to(SiteSetting.tos_url) if page == 'tos' and !SiteSetting.tos_url.blank?
|
||||
return redirect_to(SiteSetting.privacy_policy_url) if page == 'privacy' and !SiteSetting.privacy_policy_url.blank?
|
||||
if site_setting_key = map[page]
|
||||
url = SiteSetting.send(site_setting_key)
|
||||
return redirect_to(url) unless url.blank?
|
||||
end
|
||||
|
||||
# Don't allow paths like ".." or "/" or anything hacky like that
|
||||
page.gsub!(/[^a-z0-9\_\-]/, '')
|
||||
|
|
|
@ -15,6 +15,7 @@ class SiteSetting < ActiveRecord::Base
|
|||
setting(:company_short_name, 'Unconfigured Forum')
|
||||
setting(:company_domain, 'www.example.com')
|
||||
setting(:tos_url, '')
|
||||
client_setting(:faq_url, '')
|
||||
setting(:privacy_policy_url, '')
|
||||
setting(:api_key, '')
|
||||
client_setting(:traditional_markdown_linebreaks, false)
|
||||
|
|
|
@ -613,6 +613,7 @@ en:
|
|||
topic_views_heat_medium: "The number of views after which a topic's heat level is medium."
|
||||
topic_views_heat_high: "The number of views after which a topic's heat level is high."
|
||||
|
||||
faq_url: "If you have a FAQ hosted elsewhere that you want to use, provide the full URL here."
|
||||
tos_url: "If you have a Terms of Service document hosted elsewhere that you want to use, provide the full URL here."
|
||||
privacy_policy_url: "If you have a Privacy Policy document hosted elsewhere that you want to use, provide the full URL here."
|
||||
|
||||
|
|
Loading…
Reference in a new issue