FEATURE: /guidelines route will always show our FAQ, ignoring the faq_url site setting

This commit is contained in:
Neil Lalonde 2014-07-10 12:58:34 -04:00
parent 70177fabf5
commit e565ae2528
35 changed files with 137 additions and 29 deletions

View file

@ -11,7 +11,7 @@ Discourse.StaticController = Em.ObjectController.extend({
}); });
Discourse.StaticController.reopenClass({ Discourse.StaticController.reopenClass({
PAGES: ['faq', 'tos', 'privacy', 'login'], PAGES: ['faq', 'tos', 'privacy', 'login', 'guidelines'],
CONFIGS: { CONFIGS: {
'faq': 'faq_url', 'faq': 'faq_url',
'tos': 'tos_url', 'tos': 'tos_url',

View file

@ -20,6 +20,9 @@ class StaticController < ApplicationController
return redirect_to(url) unless url.blank? return redirect_to(url) unless url.blank?
end end
# The /guidelines route ALWAYS shows our FAQ, ignoring the faq_url site setting.
page = 'faq' if page == 'guidelines'
# Don't allow paths like ".." or "/" or anything hacky like that # Don't allow paths like ".." or "/" or anything hacky like that
page.gsub!(/[^a-z0-9\_\-]/, '') page.gsub!(/[^a-z0-9\_\-]/, '')
@ -35,6 +38,7 @@ class StaticController < ApplicationController
end end
if lookup_context.find_all("#{file}.html").any? if lookup_context.find_all("#{file}.html").any?
@faq_overriden = !SiteSetting.faq_url.blank?
render file, layout: !request.xhr?, formats: [:html] render file, layout: !request.xhr?, formats: [:html]
return return
end end

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Podmínky používání</a></li> <li><a href="<%=tos_path%>">Podmínky používání</a></li>
<li><a href="<%=privacy_path%>">Ochrana soukromí</a></li> <li><a href="<%=privacy_path%>">Ochrana soukromí</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Terms of Service</a></li> <li><a href="<%=tos_path%>">Terms of Service</a></li>
<li><a href="<%=privacy_path%>">Privacy</a></li> <li><a href="<%=privacy_path%>">Privacy</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Conditions générales d'utilisation</a></li> <li><a href="<%=tos_path%>">Conditions générales d'utilisation</a></li>
<li><a href="<%=privacy_path%>">Protection des données</a></li> <li><a href="<%=privacy_path%>">Protection des données</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">자주하는 질문</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">서비스 이용약관</a></li> <li><a href="<%=tos_path%>">서비스 이용약관</a></li>
<li><a href="<%=privacy_path%>">개인정보 취급방침</a></li> <li><a href="<%=privacy_path%>">개인정보 취급방침</a></li>
</ul> </ul>

View file

@ -1,6 +1,11 @@
<div> <div>
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="&quot;FAQ&lt;/a"></a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="tos">Warunki Korzystania</a></li> <li><a href="tos">Warunki Korzystania</a></li>
<li><a href="&quot;Polityka" prywatno></a></li> <li><a href="&quot;Polityka" prywatno></a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Termos de Serviço</a></li> <li><a href="<%=tos_path%>">Termos de Serviço</a></li>
<li><a href="<%=privacy_path%>">Privacidade</a></li> <li><a href="<%=privacy_path%>">Privacidade</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Условия предоставления услуг</a></li> <li><a href="<%=tos_path%>">Условия предоставления услуг</a></li>
<li><a href="<%=privacy_path%>">Конфиденциальность</a></li> <li><a href="<%=privacy_path%>">Конфиденциальность</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="<%=faq_path%>">Часті запитання</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="<%=tos_path%>">Умови Використання</a></li> <li><a href="<%=tos_path%>">Умови Використання</a></li>
<li><a href="<%=privacy_path%>">Приватність</a></li> <li><a href="<%=privacy_path%>">Приватність</a></li>
</ul> </ul>

View file

@ -1,5 +1,10 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a class="active" href="/faq">常见问答FAQ</a></li> <% if @faq_overriden %>
<li><a class="active" href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% else %>
<li><a class="active" href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<% end %>
<li><a href="/tos">服务条款</a></li> <li><a href="/tos">服务条款</a></li>
<li><a href="/privacy">隐私条款</a></li> <li><a href="/privacy">隐私条款</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Podmínky používání</a></li> <li><a href="<%=tos_path%>">Podmínky používání</a></li>
<li><a class="active" href="<%=privacy_path%>">Ochrana soukromí</a></li> <li><a class="active" href="<%=privacy_path%>">Ochrana soukromí</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Terms of Service</a></li> <li><a href="<%=tos_path%>">Terms of Service</a></li>
<li><a class="active" href="<%=privacy_path%>">Privacy</a></li> <li><a class="active" href="<%=privacy_path%>">Privacy</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Conditions générales d'utilisation</a></li> <li><a href="<%=tos_path%>">Conditions générales d'utilisation</a></li>
<li><a class="active" href="<%=privacy_path%>">Protection des données</a></li> <li><a class="active" href="<%=privacy_path%>">Protection des données</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">자주하는 질문</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">서비스 이용약관</a></li> <li><a href="<%=tos_path%>">서비스 이용약관</a></li>
<li><a class="active" href="<%=privacy_path%>">개인정보 취급방침</a></li> <li><a class="active" href="<%=privacy_path%>">개인정보 취급방침</a></li>
</ul> </ul>

View file

@ -1,6 +1,9 @@
<div> <div>
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="&quot;FAQ&lt;/a"></a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="tos">Warunki Korzystania</a></li> <li><a href="tos">Warunki Korzystania</a></li>
<li><a class="active" href="&quot;Privacy&lt;/a"></a></li> <li><a class="active" href="&quot;Privacy&lt;/a"></a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Termos de Serviço</a></li> <li><a href="<%=tos_path%>">Termos de Serviço</a></li>
<li><a class="active" href="<%=privacy_path%>">Privacidade</a></li> <li><a class="active" href="<%=privacy_path%>">Privacidade</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Условия предоставления услуг</a></li> <li><a href="<%=tos_path%>">Условия предоставления услуг</a></li>
<li><a class="active" href="<%=privacy_path%>">Конфиденциальность</a></li> <li><a class="active" href="<%=privacy_path%>">Конфиденциальность</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">Часті запитання</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="<%=tos_path%>">Умови Використання</a></li> <li><a href="<%=tos_path%>">Умови Використання</a></li>
<li><a class="active" href="<%=privacy_path%>">Приватність</a></li> <li><a class="active" href="<%=privacy_path%>">Приватність</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="/faq">常见问答FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a href="/tos">服务条款</a></li> <li><a href="/tos">服务条款</a></li>
<li><a class="active" href="/privacy">隐私条款</a></li> <li><a class="active" href="/privacy">隐私条款</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Podmínky používání</a></li> <li><a class="active" href="<%=tos_path%>">Podmínky používání</a></li>
<li><a href="<%=privacy_path%>">Ochrana soukromí</a></li> <li><a href="<%=privacy_path%>">Ochrana soukromí</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Terms of Service</a></li> <li><a class="active" href="<%=tos_path%>">Terms of Service</a></li>
<li><a href="<%=privacy_path%>">Privacy</a></li> <li><a href="<%=privacy_path%>">Privacy</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Conditions générales d'utilisation</a></li> <li><a class="active" href="<%=tos_path%>">Conditions générales d'utilisation</a></li>
<li><a href="<%=privacy_path%>">Protection des données</a></li> <li><a href="<%=privacy_path%>">Protection des données</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">자주하는 질문</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">서비스 이용약관</a></li> <li><a class="active" href="<%=tos_path%>">서비스 이용약관</a></li>
<li><a href="<%=privacy_path%>">개인정보 취급방침</a></li> <li><a href="<%=privacy_path%>">개인정보 취급방침</a></li>
</ul> </ul>

View file

@ -1,6 +1,9 @@
<div> <div>
<ul class="tx_dqsymbolnav-pillstx_dqsymbol"> <ul class="tx_dqsymbolnav-pillstx_dqsymbol">
<li><a href="&quot;FAQ&lt;/a"></a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="&quot;Terms" of service></a></li> <li><a class="active" href="&quot;Terms" of service></a></li>
<li><a href="&quot;Privacy&lt;/a"></a></li> <li><a href="&quot;Privacy&lt;/a"></a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Terms of Service</a></li> <li><a class="active" href="<%=tos_path%>">Terms of Service</a></li>
<li><a href="<%=privacy_path%>">Privacy</a></li> <li><a href="<%=privacy_path%>">Privacy</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Условия предоставления услуг</a></li> <li><a class="active" href="<%=tos_path%>">Условия предоставления услуг</a></li>
<li><a href="<%=privacy_path%>">Конфиденциальность</a></li> <li><a href="<%=privacy_path%>">Конфиденциальность</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="<%=faq_path%>">Часті Питання</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="<%=tos_path%>">Умови використання</a></li> <li><a class="active" href="<%=tos_path%>">Умови використання</a></li>
<li><a href="<%=privacy_path%>">Приватність</a></li> <li><a href="<%=privacy_path%>">Приватність</a></li>
</ul> </ul>

View file

@ -1,5 +1,8 @@
<ul class="nav-pills"> <ul class="nav-pills">
<li><a href="/faq">常见问答FAQ</a></li> <% if @faq_overriden %>
<li><a href="<%=guidelines_path%>"><%=t "guidelines" %></a></li>
<% end %>
<li><a href="<%=faq_path%>"><%=t "js.faq" %></a></li>
<li><a class="active" href="/tos">服务条款</a></li> <li><a class="active" href="/tos">服务条款</a></li>
<li><a href="/privacy">隐私条款</a></li> <li><a href="/privacy">隐私条款</a></li>
</ul> </ul>

View file

@ -107,6 +107,8 @@ en:
links: Links links: Links
faq: "FAQ" faq: "FAQ"
privacy_policy: "Privacy Policy" privacy_policy: "Privacy Policy"
privacy: "Privacy"
terms_of_service: "Terms of Service"
mobile_view: "Mobile View" mobile_view: "Mobile View"
desktop_view: "Desktop View" desktop_view: "Desktop View"
you: "You" you: "You"

View file

@ -1631,3 +1631,5 @@ en:
color_schemes: color_schemes:
base_theme_name: "Base" base_theme_name: "Base"
guidelines: "Guidelines"

View file

@ -176,7 +176,7 @@ Discourse::Application.routes.draw do
post "login" => "static#enter" post "login" => "static#enter"
get "login" => "static#show", id: "login" get "login" => "static#show", id: "login"
get "faq" => "static#show", id: "faq" get "faq" => "static#show", id: "faq"
get "guidelines" => "static#show", id: "faq" get "guidelines" => "static#show", id: "guidelines"
get "tos" => "static#show", id: "tos" get "tos" => "static#show", id: "tos"
get "privacy" => "static#show", id: "privacy" get "privacy" => "static#show", id: "privacy"
get "signup" => "list#latest" get "signup" => "list#latest"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

File diff suppressed because one or more lines are too long